pieterderycke / Jace

Jace.NET is a calculation engine for the .NET platform.
MIT License
436 stars 94 forks source link

Arbitrary symbol name handling could be allowed with square brackets #6

Closed rummelsworth closed 10 years ago

rummelsworth commented 10 years ago

It seems like square brackets are ignored during tokenization, so perhaps they could be used to allow a user to enter a variable name that is any string they'd like, e.g. with spaces, numbers at the beginning, etc.

Not sure how I'd make this change myself, but I'm looking into it when I have a chance.

pieterderycke commented 10 years ago

I will not fix/implements this, a new version of Jace is under development that will support matrix calculations. The square brackets will be used to indicate arrays.

rummelsworth commented 10 years ago

@pieterderycke Is there a possibility of using some other character(s)/syntax to delimit an arbitrary symbol name?

Anything would be nice, e.g. C# verbatim string literal-style @"My variable named ""variable"": A tale of redemption". (Not a good symbol name, I know, but who knows what a user/client might decide as a name of some entity which must be symbolized in an expression given to Jace :-))

Perhaps @ is being used already somewhere in Jace, but if not, the above approach could be worthwhile. Maybe include a little utility function that takes strings and converts them to whatever style you might consider (for insertion into an expression that is then fed back into CalculationEngine, for example).

[ps: I saw your other posts and will get back to you as soon as I can about them. Thanks.]

pieterderycke commented 10 years ago

The "@" symbol is not yet used. So I could use it the support variables with spaces in the name, genre @"A variable with spaces" but I am currently not really convinced its a good idea to allow such variables an why applications using Jace would need it.

But feel free to come with arguments/examples if you want to try convincing me :-)