Is the following really supposed to be acceptable? Both Poly/ML and mlton accept it without complaining:
datatype '+ = C | D;
(Moscow ML rejects it. mlton and Poly/ML treat it as the declaration of a unary type operator called +.)
and what about
datatype '' foo = C | D;
Michael
Funnily enough, I noticed a similar thing the other day: ' and '' are perfectly good identifiers for type variables, I presume.
Regards,
Rob.
On 22 Apr 2013, at 02:31, Michael Norrish michael.norrish@nicta.com.au wrote:
Is the following really supposed to be acceptable? Both Poly/ML and mlton accept it without complaining:
datatype '+ = C | D;
(Moscow ML rejects it. mlton and Poly/ML treat it as the declaration of a unary type operator called +.)
and what about
datatype '' foo = C | D;
Michael
polyml mailing list polyml@inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
On Apr 22, 2013, at 03:31 , Michael Norrish Michael.Norrish@nicta.com.au wrote:
Is the following really supposed to be acceptable? Both Poly/ML and mlton accept it without complaining:
datatype '+ = C | D;
(Moscow ML rejects it. mlton and Poly/ML treat it as the declaration of a unary type operator called +.)
and what about
datatype '' foo = C | D;
MLton and Poly/ML are correct. A type variable can be named plain ' or '', and symbolic identifiers (except *) are allowed as type names.
/Andreas
On 22/04/13 4:29 PM, Andreas Rossberg wrote:
On Apr 22, 2013, at 03:31 , Michael Norrish Michael.Norrish@nicta.com.au wrote:
Is the following really supposed to be acceptable? Both Poly/ML and mlton accept it without complaining:
datatype '+ = C | D;
(Moscow ML rejects it. mlton and Poly/ML treat it as the declaration of a unary type operator called +.)
and what about
datatype '' foo = C | D;
MLton and Poly/ML are correct. A type variable can be named plain ' or '', and symbolic identifiers (except *) are allowed as type names.
Wow; you learn something new everyday.
Thanks for the quick feedback.
Incidentally, I think that makes your grammar at http://www.mpi-sws.org/~rossberg/sml.html incorrect: the grammar there wants an <id> to follow the apostrophe for <var>, and <id>s have at least one character in them.
Best, Michael
On 04/22/2013 10:09 AM, Michael Norrish wrote:
On 22/04/13 4:29 PM, Andreas Rossberg wrote:
On Apr 22, 2013, at 03:31 , Michael Norrish Michael.Norrish@nicta.com.au wrote:
Is the following really supposed to be acceptable? Both Poly/ML and mlton accept it without complaining:
datatype '+ = C | D;
(Moscow ML rejects it. mlton and Poly/ML treat it as the declaration of a unary type operator called +.)
and what about
datatype '' foo = C | D;
MLton and Poly/ML are correct. A type variable can be named plain ' or '', and symbolic identifiers (except *) are allowed as type names.
Wow; you learn something new everyday.
Thanks for the quick feedback.
Incidentally, I think that makes your grammar at http://www.mpi-sws.org/~rossberg/sml.html incorrect: the grammar there wants an <id> to follow the apostrophe for <var>, and <id>s have at least one character in them.
Yes, you are right. I was (semi-intentionally) sloppy there. Fixed.
Thanks, /Andreas
On 22/04/13 18:54, Andreas Rossberg wrote:
Incidentally, I think that makes your grammar at http://www.mpi-sws.org/~rossberg/sml.html incorrect: the grammar there wants an <id> to follow the apostrophe for <var>, and <id>s have at least one character in them.
Yes, you are right. I was (semi-intentionally) sloppy there. Fixed.
Another case where your grammar and polyml + mlton disagree is
datatype '2 foo = C | D;
Michael