polterguy / lizzie

A script language for .Net and the CLR
https://ainiro.io/
MIT License
190 stars 27 forks source link

IsNumeric and negatives #25

Closed SapphireBrand closed 5 years ago

SapphireBrand commented 5 years ago

So we need a way to have "-17" be a valid number.

I think the simplest is to allow IsNumeric to accept a leading minus sign. (That is, I don't think there are any potential confusions in lexing/parsing regarding minus signs. But maybe I missed something.)

Some languages support -17 using "unary minus" (AKA negation). But that would be awkward in Lizzie syntax, because unary minus would have parentheses: "-(17)". (Separate issue is filed requesting unary minus support.)

polterguy commented 5 years ago

I agree, -17 should be understood as negative 17 ...

polterguy commented 5 years ago

Fixed (in repo)!