🎉 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: Type Parameterization, Part 1

Published September 08, 2008
Advertisement
It's been a slow two weeks with Disgaea 3 and American Labor Day occupying a lot of my time. Such layoffs seem to help though; they provide time to design. Time to scheme up good solutions for things. Like this. The problem is directly from Tangent internals. A type holds a number of definitions. Binding a type parameter changes that type into a new type. Dot Net methods are held as method info bits (at the moment) for invocation. Their grip on their owners or the owners is slim. And for concrete types, this works well. Generic Types... less good.


Anyways, I devised a solution that is less icky than the alternative, but still substantially different from what I was aiming for. I essentially took the code to infer generic method parameters and use it to line up the unbound method infos with their bound brethren.

Combined with the work I've been doing on .NET imports, and this code now works:

public static void main(){	local List<int> lint = new List<int>; 	lint.Add(42);	print lint.Count;	// lint.Add("moo");    // Error.}


Nicely imported (right now hard-coded imports until the compiler UI is improved and 'using ' works), as type-safe as everything else, and shouldn't break if used with other .NET imported stuff. Not quite usable yet though. There's a minor bug passing Tangent types as the type param (but it will be supported). Indexers don't work and enumerators aren't imported nicely yet due to the 1.0/2.0 clusterfuck around them... So you can't actually get anything out of the container.

So imports mostly work, and type parameterization pretty much works; needs polish. Oh, and you can't define generic types in Tangent yet. So that now goes into the queue to replace what I did get done.

The immediate queue is polish for the imports/parameterization, fix property = property behavior, some semi-substantial test app now that containers work, indexers, generic type definitions, 'phrase' definitions (see 2 posts down), for/foreach loops... in some order as my whimsy deems fit and Disgaea allows.
Previous Entry Tangent Tidbits.
Next Entry Tangent: Indexers
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