Standard class API
Posted: Tue Jun 14, 2011 9:41 pm
tl;dr: Class Commons
As some of the guys in irc have probably seen, I want there to be a standard api for our class systems. Now, I understand it is not desirable for every class system to be the same, I mean, what would be the point in that? No, my goal is an api other libs can use. So, if you find yourself a lib that uses classes in some way, say a gamestate manager, you can use it with the class system of your choice.
Let's do an example
Where in all these examples the gamestates lib is exactly the same, without any code changes.
Wouldn't this be awesome?
Now, of course there's a lot of stuff to discuss here, but first I want to know if there's interest in this, and whether the makers of various commonly used class libs are willing to work with me on this.
I set up a wiki page for this here: Class Commons.
If I didn't feature your class lib, sorry, I chose 4 I know of, and I can't make this a huge list, can I?
Also, if I did, but I butchered the syntax, again sorry, I did this after a quick glance at the examples.
As some of the guys in irc have probably seen, I want there to be a standard api for our class systems. Now, I understand it is not desirable for every class system to be the same, I mean, what would be the point in that? No, my goal is an api other libs can use. So, if you find yourself a lib that uses classes in some way, say a gamestate manager, you can use it with the class system of your choice.
Let's do an example
Code: Select all
--using Slither
require "slither"
require "slither-compat"
require "gamestates"
class "MyAwesomeState" ("Gamestate") {
--stuff
}
Code: Select all
--using SECS
require "secs"
require "secs-compat"
require "gamestates"
MyAwesomeState = Gamestate:new()
--stuff
Code: Select all
--using MiddleClass
require "middleclass"
require "middleclass-compat"
require "gamestates"
MyAwesomeState = class("MyAwesomeState", Gamestate)
--stuff
Code: Select all
--using HUMP
--yes, I know that has a gamestate manager, this is an example
Class = require "hump.class"
require "hump.class-compat"
require "gamestates"
MyAwesomeState = Class{inherits = Gamestate}
--stuff
Wouldn't this be awesome?
Now, of course there's a lot of stuff to discuss here, but first I want to know if there's interest in this, and whether the makers of various commonly used class libs are willing to work with me on this.
I set up a wiki page for this here: Class Commons.
If I didn't feature your class lib, sorry, I chose 4 I know of, and I can't make this a huge list, can I?
Also, if I did, but I butchered the syntax, again sorry, I did this after a quick glance at the examples.