mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.6 KiB
46 lines
1.6 KiB
--- !ditz.rubyforge.org,2008-03-06/issue
|
|
title: add a non-standard getter/setter 'key' argument
|
|
desc: |-
|
|
Standard getter gets the original object in the 'this' binding and no
|
|
arguments. Standard setter gets the original object in the 'this' binding
|
|
and no other arguments. Because the key is not given, user code must
|
|
create multiple accessor function objects (or use the Proxy object).
|
|
|
|
Extend both getter and setter argument list with the key argument. This
|
|
will probably break very little code and is easy to achieve when a setter
|
|
or getter is triggered by a property access:
|
|
|
|
print(foo.bar); // getter
|
|
foo.bar = 'quux'; // setter
|
|
|
|
However, setter/getter can also be invoked "out of context":
|
|
|
|
var desc = Object.getOwnPropertyDescriptor(foo, 'bar');
|
|
var getter = desc.get;
|
|
print(getter());
|
|
|
|
Above, the getter is invoked with the expectation that it will return the
|
|
same value as when evaluating "foo.bar". However, Duktape won't know the
|
|
property name from context of the call.
|
|
|
|
Even with this limitation, it might be worthwhile to extend the accessor
|
|
behavior, which will still be useful for most code.
|
|
type: :task
|
|
component: duk
|
|
release: v0.11
|
|
reporter: Sami Vaarala <sami.vaarala@iki.fi>
|
|
status: :closed
|
|
disposition: :fixed
|
|
creation_time: 2014-06-12 22:59:13.174464 Z
|
|
references: []
|
|
|
|
id: 7b588526e608305af04054ed760a13a5c137c4e5
|
|
log_events:
|
|
- - 2014-06-12 22:59:13.265944 Z
|
|
- Sami Vaarala <sami.vaarala@iki.fi>
|
|
- created
|
|
- ""
|
|
- - 2014-06-13 21:52:06.384447 Z
|
|
- Sami Vaarala <sami.vaarala@iki.fi>
|
|
- closed with disposition fixed
|
|
- ""
|
|
|