• entries
359
237
• views
189653

# Tangent: Explicit Symbols.

255 views

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).

There are no comments to display.

## Create an account

Register a new account

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.