After all, why make the computer work really hard to figure out what the user wrote in their stack effect comments, when instead the compiler can just read them?
( ... )
is formal syntax now, and may only follow a word definition:: foo ( a b -- c ) 2 + * ;
If a word is not recursive, the stack effect declaration is optional. If the inferred stack effect does not match the declared stack effect, the compiler issues an error. On the other hand, recursive words now require a stack effect declaration in order to compile. Stack effects of arbitrary quotations can still be inferred as before.
Note that because of how delegation is implemented, all generic words are recursive internally, and need a stack effect declaration in order to compile. And finally, if you add a stack effect declaration to a word that does not have a static stack effect, for whatever reason, the declaration is ignored.
2 comments:
Oh my god, pretty soon you'll be adding optional static type declarations! What's the world coming to?
There's no reason to rule out that possibility.
Post a Comment