Related to the "You're going to have to rewrite it anyway" discussion here: 
https://groups.google.com/forum/#!topic/nodejs/VlUJ68n6QBg (and here: 
http://atxconsulting.com/2013/07/06/rewrite-it-anyway/).

https://github.com/rvagg/nan is an evolution of code I've been gathering 
for a while now to make addon compatibility easier. The 0.11.4 V8 changes 
introduce major trauma and the last thing we all need are conditionals all 
through our code just to make it work across versions so the aim of NAN is 
to provide basic utilities that completely remove the need for conditionals 
as 0.11 evolves while maintaining compatibility all the way back to at 
least 0.8.

I know that TJ and others are interested in working on a more complete 
abstraction that serves us into the future, beyond 1.0 and NAN may become 
obsolete, depending on the scope of this new work. I personally hate having 
to sit on breaking changes and am not comfortable waiting for much later in 
the 0.11 cycle for something that can let me test my addons against the 
latest code, so I was working on this anyway.

As a simple example, consider this code:


   - Node 0.8/0.10 (breaks in 0.11): 
   
https://github.com/rvagg/node-addon-examples/blob/master/9_async_work/async.cc
   - Node 0.11 (incompatible with pre-0.11): 
   
https://github.com/kkoopa/node-addon-examples/blob/5c01f58fc993377a567812597e54a83af69686d7/9_async_work/async.cc
   - NAN (0.8/0.10/0.11): 
   https://github.com/rvagg/nan/blob/master/examples/async_pi_estimate/async.cc

And NAN in actual addon code:

   - Here's how NAN is used to adapt LevelDOWN to the 0.11 changes: 
   https://github.com/rvagg/node-leveldown/pull/48/files
   - Here it is against ssh (libssh binding): 
   
https://github.com/rvagg/node-libssh/commit/a983d055a6c4e32f248e6ec026cb128828a8e35d
   - And here it is against node-canvas (may or may not be merged but it 
   was a good challenge): 
   https://github.com/LearnBoost/node-canvas/pull/305/files


The plan is to try and keep up with breaking changes so new features may be 
added as required. For now it's fairly minimal with some extra utilities 
that I just find useful for Node/V8 C++ development, not strictly related 
to compatibility.

Feedback welcome of course and I'd appreciate any additional challenges 
that your addons may need tackling that I haven't addressed yet.

Cheers,
 -- Rod


-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to