You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Motivation
Prism supports a rest property in grammars that essentially functions as an object spread replacement. The behavior of rest and object spread is subtly different, so we can't remove support for rest, unfortunately. However, we may as well fix the worst aspect of rest: it gets in the way of token iteration.
Everything that processes or analyses grammars has to take rest into account, because rest is the only property of a grammar that isn't a token (this also creates problems with TS).
Description
Replace the rest property with a symbol, let's call it Prism.rest.
This will solve the iteration problem, because symbols are non-enumerable by default.
This will also make it possible to finally define a proper type for Prism grammars, which simply wasn't possible before.
Motivation
Prism supports a
rest
property in grammars that essentially functions as an object spread replacement. The behavior ofrest
and object spread is subtly different, so we can't remove support forrest
, unfortunately. However, we may as well fix the worst aspect ofrest
: it gets in the way of token iteration.Everything that processes or analyses grammars has to take
rest
into account, becauserest
is the only property of a grammar that isn't a token (this also creates problems with TS).Description
Replace the
rest
property with a symbol, let's call itPrism.rest
.This will solve the iteration problem, because symbols are non-enumerable by default.
This will also make it possible to finally define a proper type for Prism grammars, which simply wasn't possible before.
The text was updated successfully, but these errors were encountered: