On 9/3/15 1:08 PM, H. S. Teoh via Digitalmars-d wrote:
On Thu, Sep 03, 2015 at 12:46:29PM -0400, Andrei Alexandrescu via Digitalmars-d 
wrote:
http://stackoverflow.com/questions/32369114/leap-years-not-working-in-date-and-time-program-in-dlang

The gist of it is the user wrote =+ instead of +=. I wonder if we
should disallow during tokenization the sequence "=", "+", whitespace.
Surely it's not a formatting anyone would aim for, but instead a
misspelling of +=.
[...]

Is there a way for the lexer to check for the specific character
sequence '=', '+', whitespace and not others (e.g. '=', whitespace,
'+')?  IOW, "a =+ b" will be prohibited, but "a = + b" will be allowed.
If so, I agree with this.

On that note, though, the unary + operator is totally useless in D...
maybe we should get rid of that instead?  (Then "=+" will automatically
be an error.)


T

What about all other operations that may be typos from op= where op is also a unary operator? e.g. =-

FWIW, I think this is a good idea, even if it's just for =+.

-Steve

Reply via email to