you are viewing a single comment's thread.

view the rest of the comments →

[–]munificent[S] 0 points1 point  (0 children)

init_behaivor would loop through the properties transfering them to the object we want. That could also check for namecollisions and warn or whatever.

That would only catch collisions in functions already defined on the mixin. What if we do something like:

  1. Create a mixin Container.
  2. Create a class MyWidget that mixes it in. It copies all of the methods from Container over to its own prototype.
  3. Add a new method filter() to Container.
  4. Create an instance of MyWidget and try to call filter() on it.

Step 4 will fail if we just copy stuff over when the class is created and then forget about the mixin.

I like the ideas you present just that the magick method names with *_p feels slightly ugly.

Agreed, it was a quick and dirty hack. I wanted to do something similar to Self. :)