Skip to content

Consider supporting "void Nan::SetMethod(v8::Local<v8::Function>" #564

Closed

Description

@springmeyer

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.

Activity

  1. kkoopa commented on Apr 29, 2016

    @kkoopa
    Collaborator

    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.

    cc @bnoordhuis @agnat

  2. agnat commented on Apr 30, 2016

    @agnat
    Collaborator

    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...

    PS: using namespace v8;

  3. kkoopa commented on May 1, 2016

    @kkoopa
    Collaborator

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions