You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The change in a90951e
broke void Nan::SetMethod(v8::Local<v8::Function>, ... usage I'd unknowingly been depending on.
Per a90951e#commitcomment-17309590 creating this ticket to discuss if this should be fixed in Nan or if users should workaround by casting to an Object.
For reference, there is no true ambiguity, a v8::Function is a v8::Object, so a v8::Local<v8::Function> is a v8::Local<v8::Object>. Node did that same change in nodejs/node@642076f and has the same problem. I tried working around it for the v8::Template case in bbf82b0, which, while ugly, is manageable, since there are only two subclasses of v8::Template. However, there are too many subclasses of v8::Object, so there has to be a better way. Something with enable_if and is_convertible might work, but is rather tedious.
I agree that unrolling is not really an option. Like you suggest, meta-programing is probably the better approach. I can look into it, but I'll need a couple of days...
For reference, there is no true ambiguity [...]
Although I like to blame the compiler just like the next guy the compiler is in the right. It is ambiguous. Function is an Object, it's true but: Local<Function> and Local<Object> are completely unrelated types. Both types are generated by the same template, but that does not imply any relation. Recall that template Local has this nasty templateized constructor... the one that triggers a STATIC_ASSERT if the two types are incompatible. This constructor makes it ambiguous since it offers a conversion from some Local<Foo> to any other Local. Anyway...
Yeah, I was using some amount of hyperbole. I did test this issue on clang as well, with the same result. However, if the compiler is not wrong, then the standard is wrong. There should be a convenient way of stating that a function accepts any A<? extends B> or similar, with normal, automatic conversion of A and B, especially in regard to B.
Anyway, there is no acute rush. While this is a regression, it is a rather small one, which is not too likely to be encountered and which can be worked around without too much effort. As I noted in the discussion on a90951e#commitcomment-17309590, developing a proper solution is expected to take at least a week.
Activity
Don't use deprecated v8::Template::Set() in SetMethod
kkoopa commentedon Apr 29, 2016
For reference, there is no true ambiguity, a
v8::Functionis av8::Object, so av8::Local<v8::Function>is av8::Local<v8::Object>. Node did that same change in nodejs/node@642076f and has the same problem. I tried working around it for thev8::Templatecase in bbf82b0, which, while ugly, is manageable, since there are only two subclasses ofv8::Template. However, there are too many subclasses ofv8::Object, so there has to be a better way. Something withenable_ifandis_convertiblemight work, but is rather tedious.cc @bnoordhuis @agnat
agnat commentedon Apr 30, 2016
I agree that unrolling is not really an option. Like you suggest, meta-programing is probably the better approach. I can look into it, but I'll need a couple of days...
Although I like to blame the compiler just like the next guy the compiler is in the right. It is ambiguous.
Functionis anObject, it's true but:Local<Function>andLocal<Object>are completely unrelated types. Both types are generated by the same template, but that does not imply any relation. Recall thattemplate Localhas this nasty templateized constructor... the one that triggers aSTATIC_ASSERTif the two types are incompatible. This constructor makes it ambiguous since it offers a conversion from someLocal<Foo>to any otherLocal. Anyway...PS:
using namespace v8;kkoopa commentedon May 1, 2016
Yeah, I was using some amount of hyperbole. I did test this issue on clang as well, with the same result. However, if the compiler is not wrong, then the standard is wrong. There should be a convenient way of stating that a function accepts any
A<? extends B>or similar, with normal, automatic conversion ofAandB, especially in regard toB.Anyway, there is no acute rush. While this is a regression, it is a rather small one, which is not too likely to be encountered and which can be worked around without too much effort. As I noted in the discussion on a90951e#commitcomment-17309590, developing a proper solution is expected to take at least a week.
Add test cases for #564
Refactor SetMethod() to deal with v8::Templates
Refactor SetMethod() to deal with v8::Templates (#566)
Refactor SetMethod() to deal with v8::Templates (#566)