When compiling (using “str bug.str”) the following Stratego program, directly taken from the on-line Stratego documentation pages

module bug
imports libstrategolib
signature
sorts Prop
constructors
False : Prop
True : Prop
Not : Prop -> Prop
rules
E : Not(True) -> False
E : Not(False) -> True
strategies
main = io-wrap (eval)
eval = innermost(E)

the following warnings are emitted

str bug.str
[ Main | warning ] Nullary constructor False used without parentheses
[ Main | warning ] Nullary constructor True used without parentheses
[ Main | warning ] Nullary constructor True used without parentheses
[ Main | warning ] Nullary constructor False used without parentheses

So, there seems to be a discrepancy between the compiler and the documentation.
What is the correct syntax: False, True, or False(), True() ?

Submitted on 19 November 2016 at 10:36

On 19 November 2016 at 13:27 Jeff Smits commented:

Nullary constructors are a feature that we inherited from the ATerm library (I think), and are legal syntax. But using postfix empty parentheses is recommended because constructors can clash with local variables (local variables can also start with an uppercase character, and some legacy constructors even start with a lowercase character).


On 19 November 2016 at 13:28 Jeff Smits commented:

By the way: where in the documentation did you find this example? Can you provide a link? Then I can remove usage of nullary constructors in the examples.


On 19 November 2016 at 13:56 Gabriël Konat moved this issue to issue 916 on project StrategoXT

On 19 November 2016 at 13:56 Gabriël Konat closed this issue.

Log in to post comments