Not really an error, more a pitfall: Using a Nil constructor (e.g., for a language which uses nil instead of null) triggers seemingly inconsistent behavior within Stratego.
(e.g., Nil() doesn’t match Nil() …)

May be nice to have the SDF and/or Stratego editor and/or the compiler warn about usage of a Nil constructor.

(Although Nil might occasionally have a real use in Stratego code as the last node in a list?)

Submitted by Tobi Vollebregt on 11 October 2011 at 11:13

On 11 October 2011 at 11:13 Tobi Vollebregt tagged pitfall

On 11 October 2011 at 11:19 Lennart Kats commented:

Interesting. Apparently this problem also exists with the C version:


echo ‘Nil’ | str ‘io-wrap(debug; ?Nil())’

fails.

I suppose a warning in the SDF editor about this would be the best fix here. Since the term library is typed, it can’t just make an empty list term when you say it has to make something with constructor “Nil”.


On 11 October 2011 at 18:29 Tobi Vollebregt closed this issue.

On 11 October 2011 at 18:29 Tobi Vollebregt commented:

added warning in r23444

I figured the parsing etc. is fine, what happens is that ?Nil() in Stratego is equivalent to ?[], and !Nil() is equivalent to ![]. Matching/building Nil can only be done using generic term construction/destruction.


On 22 December 2011 at 16:54 Lennart Kats tagged 1.0

On 22 December 2011 at 16:55 Lennart Kats tagged @tvo

Log in to post comments