Jump to content
  • Advertisement
  • entries
  • comments
  • views

Tangent: Explicit Symbols.

Sign in to follow this  


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).
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!