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 13:56

On 19 November 2016 at 14:02 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).
(I’m fixing the docs on ReadTheDocs)


On 19 November 2016 at 14:10 hubert commented:

Thanks!
The above program was a shortened version of the example given on
http://metaborg.org/en/latest/source/langdev/meta/lang/stratego/04-term-rewriting.html


On 19 November 2016 at 14:14 Jeff Smits commented:

Thanks for the link. I fixed this part of the docs. But please note that the Stratego docs are still out of date in some other areas.

Log in to post comments