Tangent: Statics

Published March 08, 2009
Advertisement
Had a little extra time tonight to work on static methods and variables, and now they work:

public class foo{	public string bar = "moo.";	public static	int baz = 6;	public static	genFoo(string initValue) => foo { 		local foo rtn = new foo;		rtn.bar = initValue;		return(rtn);	}}public static 	main()=>void{	local foo Foo = new foo;	Foo = foo.genFoo("bleat.");	print Foo.bar;                // bleat.	print foo.baz;                // 6}


This turned out to be one of those things that looks simple and should be simple, but is just a pain to implement. Even though it's 'working' now, I'm marginally afraid to do anything more complex than the example code. I can practically hear the bugs crawling about in the hackery used to get it working.

That leaves 'this' methods and generics (and the inevitable debuggery from this mess) in this batch of cleanup. Far too much. I must continue the focus on making little hard examples work. One tiny step at a time.
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