🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Tangent: Explicit Symbols.

Published February 15, 2009
Advertisement
So much for all that time during the week I was going to have to work on the Tangent cleanup... I did get a little time this morning and added a small feature that's going to be needed with the changes to how method declarations are dealt with.

In 0.25 you can specify literal identifiers to be part of a method/phrase, ie:

public static void      foo bar{...}


To invoke the method you must have the identifier foo next to bar (regardless of any declarations for bar). The small feature is to expand that to a subset of symbols generally used for operations. ie

public static   foo ! => void {...}public static   +> => void {...}


Generally these things won't return void and will be used in longer phrases:

public static    (string lhs) ++ (string rhs) => string { return( lhs.concat(rhs); }public static    (int lhs) ** (int rhs) => int { return(Math.exp(lhs,rhs)); }


Technically, these are 4 element phrases. + op that takes a string and a + literal and returns a method that takes a string and returns a string.

Aside: though from a design standpoint, it would be better to define a simple method ++ that returns a more verbose operator that does concatenation. Otherwise you can't pass simply '++' to a delegate. Perhaps I'll change the code to do that automatically...

While this sort of thing can easily be used to dominate the first annual obfuscated Tangent contest, it also provides people who are going to develop DSL's within the language to define symbolic operators in a nice readable fashion without me specifically telling them what can and cannot be utilized (beyond a few in-grained operators).
Next Entry FLU!
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement