Anyways, on to the feature:
Before the change, Tangent method declarations were in the form:
return-type identifier() [block|semi-colon]
(with generics and constraints left to be implemented) After the change, method declarations are of the form:
return-type identifier [()|identifier]+ [block|semi-colon]
Or to sum up for those who might not know regex/bnf symbols, instead of a number of traditional C-like method parameters in parens, you can provide any number of similar parens or identifiers as the parameter list to a method.
Example code:
[source lang = "C#"]public void bar for (bool really){ if(really){ print "Yeah, I can cover everyone!\r\n"; }else{ print "Eh... put it on the card.\r\n"; }}public void bar for everyone{ print "Everyone!!!\r\n"; }public void bar me{ print "me.\r\n"; }public void bar you{ print "you.\r\n"; }public void bar (bool eh){ if(eh){ print "EH!\r\n"; }else{ print "enh.\r\n"; }}public static void main(){ bar me; bar you; bar true; bar(false); bar for everyone; bar for true; bar for false;}
me.you.EH!enh.Everyone!!!Yeah, I can cover everyone!Eh... put it on the card.
for isn't a keyword (yet) so is an acceptable identifier in this context. The declarations are essentially sugar for more complex interactions. The first example above could be defined as:
public class intermediary{ public void this(bool really){ if(really){ print "Yeah, I can cover everyone!\r\n"; }else{ print "Eh... put it on the card.\r\n"; } }}public intermediary bar for{ return(new intermediary); }
Which of course becomes a lot more complicated when the intermediary needs to store bound params and determine the final baked method. Since this sort of thing seemed like something that people would want to do to customize the syntax towards a particular domain, and the process of creating these intermediary types was very mechanical... I sugar'd it. The compiler itself generates these stupid little intermediary types and does the parameter manipulation for you.
The addition of simple identifiers as parameters is to allow call-location info to the parameters when there becomes a number of them. Also it will allow a little more verbose/natural syntaxes with smaller effort. And as an added bonus, they can serve as an extra token to distinguish between methods in a group which take the same number and type of parameters.
I personally think that it's a useful addition, and something that is a natural extension to some of the other weird stuff that sets Tangent apart. My coworker thinks it's a mistake; a tool too easily used for obfuscation in a language already leaning towards the ambiguous. Experience using the language will tell I think. Now that this feature is done, I can hopefully go back and polish properties and imports and type binding... Actually use or at least release for others to get some of that feedback.
These identifiers *could* be optional, but for that you'd need to drop some of those cool function overloads, with a single identifier distinguishing between two functions -- which wouldn't be possible in that case. Another thing you don't have there is commas mixed with identifiers, it's a natural way to split up parameters and it would probably help a lot to clear some obfuscation. My latest programming language project (which isn't being actively developed at the time) had all of this and you could easily create a DSL similar to Inform, so you could almost type in plain english what you wanted to happen. Anyways this is great, I'm sure many people would prefer a scripting language for their game that allows intuitive syntax over a c-style language, to let non-programming folks add to the content pipeline. Keep it up!