Skip to content

Nogcmacro - #489

Open
kkoopa wants to merge 2 commits into
nodejs:mainfrom
kkoopa:nogcmacro
Open

Nogcmacro#489
kkoopa wants to merge 2 commits into
nodejs:mainfrom
kkoopa:nogcmacro

Conversation

@kkoopa

Copy link
Copy Markdown
Collaborator

Tried to remove the dependence on macros.
The gc callback thing feels a bit clumsy.

Comment threadnan.h Outdated

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@agnat

Copy link
Copy Markdown
Collaborator

The gc callback thing feels a bit clumsy.

I see you pulled the direct call trick ... other than that. Please elaborate...

@kkoopa

Copy link
Copy Markdown
CollaboratorAuthor

I would like to get the callback as a function argument, like in all other parts of the API, but that is not possible. This will remain a slightly odd case.

On October 10, 2015 1:13:19 PM GMT+03:00, David Siegel notifications@github.com wrote:

The gc callback thing feels a bit clumsy.

I see you pulled the direct call trick ... other than that. Please
elaborate...


Reply to this email directly or view it on GitHub:
#489 (comment)

@kkoopa

Copy link
Copy Markdown
CollaboratorAuthor

Yeah, this is all mostly for the next major, whenever that is. Not worth breaking compatibility over these small things alone. Just figured I'd explore the possibilities. This seems to be the best way of defining callbacks when no arbitrary data arguments are available.

@kkoopa

Copy link
Copy Markdown
CollaboratorAuthor

The ugliness could be avoided by using a static map of gc callbacks, but I don't know if it is worth it.

@agnat

Copy link
Copy Markdown
Collaborator

Hm, yeah... a homegrown v-table... not sure... in my book that would be even more ugly as it introduces a call overhead of O(n log(n)) (I think) with n being the number of NAN based modules. Not that anyone would notice but I like the template version better...

@agnat

Copy link
Copy Markdown
Collaborator

BTW, I don't think it's ugly... it's merely a bit inconsistent. Actually I think I like it. The pattern has interesting properties.

@kkoopa

Copy link
Copy Markdown
CollaboratorAuthor

This would only be for the gc callbacks. There n would grow with the number of gc callbacks. How likely are you to use many of such an obscure item? Inconsistency is arguably ugliness, but I prefer this over macros. C++11 lifts a lot of these restrictions, but we can't use that everywhere yet, which is kind of limiting.

@kkoopakkoopa added this to the 3.0 milestone Oct 10, 2015
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@kkoopa@agnat