On Thu, Nov 13, 2008 at 8:36 AM, Johan Compagner <[EMAIL PROTECTED]> wrote:
>>
>> It would be nice to be able to do
>>
>> foo.class
>>
>>
> why would you want to do that?
>
> var x = java.lang.String
>
> then i have the class i dont need to do
>
> var x = java.lang.String.class
>
> so what does .class bring you?
I didn't mean it related to the OOP idea of "class". I'm thinking in
terms of objects like hash maps where I may want a "class" key.
For client-side programming it would be nice if it was possible to set
the class attribute of an element with
document.getElementById("foo").class = "bar";
The lack of being able to write foo.class is likely the reason we have
to write foo.className for the class attribute on elements.
Or when building up a data structure (perhaps to be serialized to JSON)
foo.class = "Mrs Hobbs Grade 6"
I think there is no real reason this syntax would not be possible.
Even if some future ES has first-class classes with a literal starting
with the token "class", it would still be possible as that literal
would never follow a period.
Peter
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino