Oh but that isn't just lua. Don't forget, lua itself is very small, but that also prevents it from having the sugary goodness that is += and friends.kikito wrote:[...]in Lua too much syntactic sugar can make your code "too fat".
middleclass & extras: middleclass 3.0 is out!
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: middleclass & middleclass-extras: Object Orientation for
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: middleclass & middleclass-extras: Object Orientation for
Well, ruby lets you do syntactic sugary things easily, elegantly, with little code and no noticeable performance impact.
... the trick being that "no noticeable performance impact" means that it will just run as slow as always, and consume more or less the same outrageous amount of memory. Which is why games aren't coded in ruby (yet).
In other news, I've decided to make (yet again) another change on the Callbacks module. It is getting smaller and better at the same time.
EDIT: and... it is up. I now how to fix the Apply module though.
EDIT2: Apply is modified, only some tests are outstanding. I'll start integrating with PÄSSION (finally)!
I'm still thinking about transforming MindState into a module. The name would have to be changed to something a bit less catchy. Probably 'Stateful': Actor:implements(Stateful) has a ring that I like. In any case, I will make the initialization to be done 'on demand' instead of 'forcefully on initialization' so people don't have the same problem TechnoCat had.
But, for now, it is time to go to bed.
... the trick being that "no noticeable performance impact" means that it will just run as slow as always, and consume more or less the same outrageous amount of memory. Which is why games aren't coded in ruby (yet).
In other news, I've decided to make (yet again) another change on the Callbacks module. It is getting smaller and better at the same time.
EDIT: and... it is up. I now how to fix the Apply module though.
EDIT2: Apply is modified, only some tests are outstanding. I'll start integrating with PÄSSION (finally)!
I'm still thinking about transforming MindState into a module. The name would have to be changed to something a bit less catchy. Probably 'Stateful': Actor:implements(Stateful) has a ring that I like. In any case, I will make the initialization to be done 'on demand' instead of 'forcefully on initialization' so people don't have the same problem TechnoCat had.
But, for now, it is time to go to bed.
When I write def I mean function.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: middleclass & middleclass-extras: Object Orientation for
Yeah, I miss being able to use variable++.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: middleclass & middleclass-extras: Object Orientation for
Small update: finished implementing the Apply specs and everything works as expected.
I've been able to remove a big dependency from middleclass and middleclass-extras: rake. Previously it was needed in order to run the tests, but now just Lua and telescope are required.
This weekend I'll see if I can transform StatefulObject into a Mixin (Stateful). I'm still not sure about it, but it feels right. It is really really the last thing I'll do before starting integration with PÄSSION.
I've been able to remove a big dependency from middleclass and middleclass-extras: rake. Previously it was needed in order to run the tests, but now just Lua and telescope are required.
This weekend I'll see if I can transform StatefulObject into a Mixin (Stateful). I'm still not sure about it, but it feels right. It is really really the last thing I'll do before starting integration with PÄSSION.
When I write def I mean function.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: middleclass & middleclass-extras: Object Orientation for
Big update!
I've done significant changes in MindState. I've even changed its name:
MindState is now called Stateful.
Not only that, StatefulObject has been transformed into a Mixin, so it behaves as the rest of the pack in middleclass-extra.
Previous version (with MindState):
New version (with Stateful):
The main advantage is that now you can inherit from other classes; the Statefulness doesn't 'force' you to use StatefulObject as a superclass. Like so, you can use a non-stateful class as a parent of a stateful class. For example, Enemy could be Goblin's superclass:
I've also cleaned up some old, unused code and conditions. Stateful should be slighly more efficient than StatefulObject.
Tomorrow I'll be updating the wiki and docs.
By the way - what is the equivalent of making a 'folder' on the wiki? I'd like to include documentation of all middleclass-extras, but having everything on one single wiki page would make it very long.
I've done significant changes in MindState. I've even changed its name:
MindState is now called Stateful.
Not only that, StatefulObject has been transformed into a Mixin, so it behaves as the rest of the pack in middleclass-extra.
Previous version (with MindState):
Code: Select all
Goblin = class('Goblin', StatefulObject)
Code: Select all
Goblin = class('Goblin'):include(Stateful)
--also valid:
Goblin = class('Goblin')
Goblin:include(Stateful)
Code: Select all
Goblin = class('Goblin', Enemy):include(Stateful)
Tomorrow I'll be updating the wiki and docs.
By the way - what is the equivalent of making a 'folder' on the wiki? I'd like to include documentation of all middleclass-extras, but having everything on one single wiki page would make it very long.
When I write def I mean function.
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: middleclass & middleclass-extras: Object Orientation for
I look forward to updating my git repo.kikito wrote:The main advantage is that now you can inherit from other classes; the Statefulness doesn't 'force' you to use StatefulObject as a superclass. Like so, you can use a non-stateful class as a parent of a stateful class. For example, Enemy could be Goblin's superclass:Code: Select all
Goblin = class('Goblin', Enemy):include(Stateful)
Either internal wiki links with [[keyword]] or a long page with a toc, table of contents, at the top.kikito wrote:By the way - what is the equivalent of making a 'folder' on the wiki? I'd like to include documentation of all middleclass-extras, but having everything on one single wiki page would make it very long.
For the internal links, you can just start linking to pages that don't exist yet. And then click on them and edit the target blank page later.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: middleclass & middleclass-extras: Object Orientation for
Aw, you do this just after I start my first project with MindState?
And no more robin = Enemy() on the wiki!
As for subpages, I'm not sure if it works in the default namespace as well, but you sometimes see page names like Main/Sub used on Wikipedia and other Mediawiki sites.
And no more robin = Enemy() on the wiki!
As for subpages, I'm not sure if it works in the default namespace as well, but you sometimes see page names like Main/Sub used on Wikipedia and other Mediawiki sites.
Help us help you: attach a .love.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: middleclass & middleclass-extras: Object Orientation for
I tried to warn in advance. I'll try to make them more visible in the future.Robin wrote:Aw, you do this just after I start my first project with MindState?
In any case, the only lines you would only have to change are the ones dealing with class creation. The rest should remain the same.
Ah, come on. If I remove that now, won't you be a little sad?Robin wrote:And no more robin = Enemy() on the wiki!
Oh ok. I thought I had seen sub-folders somewhere. I'll just do regular pages with names preceded by middleclass-extras.Robin wrote:As for subpages, I'm not sure if it works in the default namespace as well, but you sometimes see page names like Main/Sub used on Wikipedia and other Mediawiki sites.
When I write def I mean function.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: middleclass & middleclass-extras: Object Orientation for
That was me, not having paid attention.
Oh, good.kikito wrote:In any case, the only lines you would only have to change are the ones dealing with class creation. The rest should remain the same.
Yes.kikito wrote:Ah, come on. If I remove that now, won't you be a little sad?
Help us help you: attach a .love.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: middleclass & middleclass-extras: Object Orientation for
With the most recent GitHub version, :include() returns nil.
EDIT: also, there doesn't seem to be a :getCurrentState() function or the like, but I want use states for callbacks. Is there a non-hackish solution for this?
EDIT: also, there doesn't seem to be a :getCurrentState() function or the like, but I want use states for callbacks. Is there a non-hackish solution for this?
Help us help you: attach a .love.
Who is online
Users browsing this forum: No registered users and 5 guests