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 10:36
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).
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.
Log in to post comments