camo icon indicating copy to clipboard operation
camo copied to clipboard

Why use .create() for instantiation?

Open TheCodeDestroyer opened this issue 8 years ago • 3 comments

So from the examples I see that we need to use Class.create() method to create a new instance is there a reason why this can't be handled in Document constructor, so we could use it like this let newClass = new Class(); since we already call super either way?

TheCodeDestroyer avatar May 05 '16 12:05 TheCodeDestroyer

This is a good question. I originally had to use .create() because in the first few versions of Camo it was using Proxies underneath. The proxy had to be set up on an object instance and not the class object. So .create() was used to set up the Proxy and has been carried over from those older versions.

Now that proxies aren't being used anymore, .create() probably isn't required. I'll look in to it and possibly deprecate it in the next version.

Thanks for bringing this up!

scottwrobinson avatar May 05 '16 14:05 scottwrobinson

Awesomesauce!

TheCodeDestroyer avatar May 06 '16 07:05 TheCodeDestroyer

+1

Any idea when this will be released?

jampy avatar May 27 '16 13:05 jampy