Stratego: unexpected warnings about nullary constructors
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 parenthesesSo, there seems to be a discrepancy between the compiler and the documentation.
Submitted on 19 November 2016 at 13:56
What is the correct syntax: False, True, or False(), True() ?
Issue Log
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)
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
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