-
Notifications
You must be signed in to change notification settings - Fork 193
Implement methods for Template, FunctionTemplate & ObjectTemplate #385
base: upgrade-to-v8-4.5
Are you sure you want to change the base?
Implement methods for Template, FunctionTemplate & ObjectTemplate #385
Conversation
@cowboyd, do you have an idea of a reason why |
Awesome to see this! I'm travelling today, but will have a look at these tomorrow. I know it seems like a lot of callbacks, but if I recall correctly, there are at least four that are necessary to implement complete "method_missing" behavior for Ruby objects. I can't say off the top of my head why the |
I kind of liked having you in our time zone :) |
I know it was nice, right? Welp. Next summer :) |
Isolate isolate(t.getIsolate()); | ||
Locker lock(isolate); | ||
|
||
t->SetLength(RTEST(r_length) ? NUM2INT(r_length) : 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could probably use the Int
equiv here.
Looking good! That is a lot of callbacks, but this really is the last piece in the puzzle before we can start putting it all together. |
I actually agree with you about the readability aspect here, and I want to make sure that this codebase is as readable as possible. I wonder if there is some common ground here that preserves readability and also safety. Maybe something like: PropertyCallbackData data(isolate, rb_data);
t->SetAccessor(
*Name(r_name),
AccessorGetter(getter, data),
AccessorSetter(setter, data),
data,
Enum<v8::AccessControl>(r_settings, v8::DEFAULT),
Enum<v8::PropertyAttribute>(r_attribute, v8::None),
AccessorSignature(r_signature)
); Hate to thrash on this, but this is one of the trickier bits of the codebase, and so it's important to get right. If you don't think it's worth it, then we'll go ahead and merge, but seeing it in action, it is quite "WTF" to see |
I completely agree we should get this right. I'm thinking something like this:
where The example you gave wouldn't work since the data should already contain the Ruby proc objects so that we can pass it to the data parameter of |
Sounds good! |
Done, sorry for taking so long.. Do you want me to squash this? |
No worries, and no need to squash unless you want to. I've been crazy busy at work, but hoping to merge this, this week. |
A ton of callbacks here :) Not sure if we will need them all though.