Garrett Smith wrote:
> The order of the boolean parameters is kind of annoying to have to remember.
>
> Would it be OK to shorten the method?
>
> obj.__setProperty__("c"); // undefined value
> obj.__setProperty__("c", 2);
> obj.__setProperty__("c", undefined, "dontenum", "readonly");
> obj.__setProperty__("c", undefined, "dontdelete");
>
Not sure what ES4 policy is on how to pass "flags". Obvious method
should be named parameters, but ES3/4 lack that feature. I also don't
recall any ES3/4 method that uses bitflags (e.g. Object.READ_ONLY |
Object.DONT_DELETE) or any variant of such flags. So that leaves strings
(as you have), or an array of strings, both of which are less efficient.
Hmm, this gives me an idea - more below.
> -- or --
>
> obj.__setProperty__("c", undefined). // Reference type.
> dontEnum().
> readOnly().
> dontDelete();
>
That kind of defeats the purpose of setting all the flags during
assignment, since this would allow you do so after assignment.
Ok, new suggestion based off previous ones:
obj.__setProperty__(prop, value)
obj.__setProperty__(prop, value, Object.DONT_ENUM)
obj.__setProperty__(prop, value, Object.READ_ONLY, Object.DONT_DELETE)
obj.__getPropertyAttribute__(prop, Object.READ_ONLY) // returns true or
false
BTW, names subject to change (could be just DONT_ENUM, or
Object.dontenum, or whatever).
-Yuh-Ruey Chen
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss