Skip to content

Commit

Permalink
Explain this vs holder
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilm committed Jan 20, 2012
1 parent 3c76932 commit 135e14b
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions slides.rst
Expand Up @@ -406,28 +406,14 @@ Linking external libs in Waf:
Holder vs This
--------------

args.Holder() refers to the object it should've been called on
so that prototype chains work.
* `args.This()` is always the this object passed in to the function

Strings to-and-fro
------------------
* `args.Holder()` runs up the prototype chain to the 'right' object

v8::String -> C string
* Signatures decide the 'right' object, automatically handled by
`NODE_PROTOTYPE_SET_METHOD`

.. code-block:: cpp
:include: strings/main.cc
:start-after: v8;
:end-before: Handle<Value> Read
Strings to-and-fro
------------------

C string -> v8::String

.. code-block:: cpp
:include: strings/main.cc
:start-at: Handle<Value> Read
:end-at: }
* **Always** use `Holder()` to be on the safe side

Things I haven't covered
------------------------
Expand Down

0 comments on commit 135e14b

Please sign in to comment.