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
Both SML/NJ and MLton's parsers reject it, but I think it's valid according to the Definition.
The Definition says: "If vid has infix status, then “exp1 vid exp2” (resp. “pat1 vid pat2”) may occur – in parentheses if necessary – wherever the application “vid{1=exp1,2=exp2}” or its derived form “vid(exp1,exp2)” (resp “vid(pat1,pat2)”) would otherwise occur."
This suggests that if the following program is valid, the program up above should be too. (And of course, both MLton and SML/NJ happily accept this program.)
nonfix ::
val ::(1 : int, []) = [1]
Just to be clear, the grammar for patterns is:
<pat> ::= <pat> <vid> <pat> # where <vid> is an infixed identifier
| <pat> : <ty>
| ...
So there is seemingly nothing preventing 1 : int :: [] from being a valid pattern. Why don't SML/NJ and MLton accept it??
The text was updated successfully, but these errors were encountered:
Is this valid SML?
Both SML/NJ and MLton's parsers reject it, but I think it's valid according to the Definition.
The Definition says: "If vid has infix status, then “exp1 vid exp2” (resp. “pat1 vid pat2”) may occur – in parentheses if necessary – wherever the application “vid{1=exp1,2=exp2}” or its derived form “vid(exp1,exp2)” (resp “vid(pat1,pat2)”) would otherwise occur."
This suggests that if the following program is valid, the program up above should be too. (And of course, both MLton and SML/NJ happily accept this program.)
Just to be clear, the grammar for patterns is:
So there is seemingly nothing preventing
1 : int :: []
from being a valid pattern. Why don't SML/NJ and MLton accept it??The text was updated successfully, but these errors were encountered: