o[f] !== undefined does not determine fixtureness, only whether f's
there.  The way to ask about fixtureness is by using a type, I think the
following should work regardless of the actual type of x in o:

  o is { x: * }

If you want to use a variable value f and not a constant name x then
(perversely) I believe the following should work:

  o is let (t = gensym())
          global.eval("type " + t + " = { " + f + ":* }; return " + t,
4)

but you have to write your own gensym.

To my knowledge there is no way to ask whether something is a getter or
setter.  That said, the draft of the reflection API is not yet out and
it seems like the kind of thing that it should possibly be able to
reveal.  (The reflection API should be able to answer the previous two
questions too.)

--lars
 

> -----Original Message-----
> From: P T Withington [mailto:[EMAIL PROTECTED] On Behalf Of 
> P T Withington
> Sent: 21. mars 2008 05:15
> To: Lars Hansen
> Cc: es4-discuss@mozilla.org
> Subject: Re: ES4 draft: Object initializers
> 
> I can ask `o[f] !== undefined` to determine if a defined 
> property named `f` exists in `o`, whether `f` is a fixture or 
> not, correct?  If I only have `o`, is there a way for me to 
> detect whether `f` is implemented as a getter in `o`, or is 
> that completely invisible to me?
> 
> On 2008-03-20, at 19:42 EDT, Lars Hansen wrote:
> > I've attempted to sum up everything we have decided about object 
> > initializers (aka object literals).  A short draft spec is included.
> > Comments welcome from everyone, especially from ES4 WG members who 
> > might remember about things I've forgotten, or correct 
> > misunderstandings.
> >
> > --lars
> > 
> <object-literals.html>_______________________________________________
> > Es4-discuss mailing list
> > Es4-discuss@mozilla.org
> > https://mail.mozilla.org/listinfo/es4-discuss
> 
> 
_______________________________________________
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to