kikito / middleclass

Object-orientation for Lua
https://github.com/kikito/middleclass
MIT License
1.77k stars 190 forks source link

Instance allocation is coupled with initialization #7

Closed kikito closed 13 years ago

kikito commented 13 years ago

In some occasions it is desirable to split object creation into two steps: the "allocation" step and the "initialization" step. This way mixins can modify instances before initialize is called.

(reference: https://github.com/kikito/middleclass-extras/issues/#issue/4 )

mebens commented 13 years ago

This'll be 1.4 right?

kikito commented 13 years ago

Pretty much, yes.

kikito commented 13 years ago

This has been solved with BlackBulletIV's pull request.

FYI - adding "fixes #7" to any commit description would have automatically closed this issue.

Also, there was a small problem on the "new" new: it used Object.allocate instead of theClass.allocate. I've changed that and released 1.4

mebens commented 13 years ago

Ah thanks, I'll remember that.

I thought Object.allocate would've worked, because it used Object.allocate(theClass), instead of theClass:allocate(). If this form still works, which I can't see how it wouldn't, it would be, in theory, faster, depending on the level of inheritance.

mebens commented 13 years ago

Oh never mind. I looked at your commit, and I now I see why. Allocate must be overridable.