From 5de8fdbc77fae99ad36c581df9d6dcf1edd5d737 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Mon, 8 May 2017 01:10:48 +0300 Subject: [PATCH] 2.2 migration note for %NativeFunctionPrototype% --- doc/release-notes-v2-2.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/release-notes-v2-2.rst b/doc/release-notes-v2-2.rst index 78a483d6..2cc11b1b 100644 --- a/doc/release-notes-v2-2.rst +++ b/doc/release-notes-v2-2.rst @@ -19,3 +19,12 @@ from Duktape v2.1.x. Note the following: longer a resized monolithic allocation which improves memory behavior for very low memory targets. If you're using a pool allocator, you may need to measure and adjust pool sizes/counts. + +* Functions pushed using duk_push_c_function() and duk_push_c_lightfunc() now + inherit from an intermediate prototype (func -> %NativeFunctionPrototype% + -> Function.prototype) which provides ``.name`` and ``.length`` getters. + The setters are intentionally missing so direct writes for these properties + fail, but you can write them using ``Object.defineProperty()`` or + ``duk_def_prop()``. The inherited getters can also be replaced if necessary. + The intermediate prototype doesn't have a named global binding, but you can + access it by reading the prototype of a pushed function.