🎉 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: Method Tests Part 1

Published February 26, 2009
Advertisement
The first little batch of method tests/examples are done and working:

public static 	foo()				=> void{ print "foo.";}public static	bar(string s)			=> void{ print s;}public static	baz(string s, int i)		=> void{ print s i;}public static	phrase(string s) (int i)	=> void{ print s i;}public static	how now brown cow  		=> void{ print "MOO!";}public static	test (int lhs) times (int rhs)	=> int{ return lhs * rhs; }public static	(int lhs) op (int rhs)		=> int{ return lhs * rhs; }public static	(string lhs) * (string rhs)	=> string{ return lhs + rhs; }public static	(string lhs) ++ (string rhs)	=> string{ return lhs + rhs; }public static 	main()=>void{	foo();	bar "moo.";	baz ("bleat.",6);	phrase "bleat." 42;	how now brown cow;	print test 4 times 6;	print 2 op 3;	print "moose:" * " umm. moose.";	print "moose:" ++ " umm. moose.";}


The only perhaps noteworthy bit is the last method, which until now never worked in source. The technical construction of that is:

+ =  (+ -> (infix (string,string) -> string))


Which the language does automatically and cleans up for you. A ton more conditions to check and bugs to fix. After that I think I'm going to work on more in depth documentation of methods, so get questions in and suggestions for the style/format now so the docs can best help you the mildly interested programmer.
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