Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify return values in DSL #427

Merged
merged 2 commits into from
Aug 25, 2023
Merged

Unify return values in DSL #427

merged 2 commits into from
Aug 25, 2023

Conversation

niknetniko
Copy link
Member

Fixes #403.

This changes the DSL to have one attribute for return values: return.
Then, to decide how to handle it:

  1. If the value is an untagged YAML string; interpret it as the string (Python) representation.
  2. If the value is an untagged object; interpret is as the advanced output channel object (for oracles).
  3. Else, interpret it as a value, like the current return behaviour.

Additionally, it introduces an additional tag, !v to explicitly mark a value as a YAML value. Some examples:

  • return: 5 is a value, an int
  • return: [5, "old"] is a value, a list
  • return: "{5, 5}" is a string representation, thus a set
  • return: !v "{5, 5}" is a value, a string
  • return: !int8 5 is a value, an int8

In most cases, this will make the test suites easier, as both statements, expressions, return values and oracle arguments all use the Python syntax by default.

This change is not backwards compatible. I'll need to go though the repositories to see where we must change usages:

  • All return_raw must become return.
  • All return with a string or object need the tag !v.

@niknetniko niknetniko marked this pull request as draft August 23, 2023 15:25
@pdawyndt
Copy link
Contributor

Maybe we should use a more explicit name then !v to improve readability.

@niknetniko
Copy link
Member Author

Maybe we should use a more explicit name then !v to improve readability.

I went for !v to reduce clutter; e.g. if you have a string return value everywhere, that's a lot of times "value" will be there.

However, better readability is also something we want, so perhaps it is better to be explicit.

@niknetniko
Copy link
Member Author

We now support both !v and !value

@niknetniko niknetniko marked this pull request as ready for review August 25, 2023 13:24
@niknetniko niknetniko merged commit ebacf1e into master Aug 25, 2023
5 checks passed
@niknetniko niknetniko deleted the unified-return branch August 25, 2023 13:26
dodona-server added a commit to dvanderfaeillie/comp-denken-sjc that referenced this pull request Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make arguments of oracle consistent with return
2 participants