Matter resolved. Thanks to all of you. Franck PORCHER T.J. Crowder wrote:
>>I will be reviewing prtotype's Class.create to see if we cannot achieve >>the same result with an anonymous function, for which Firefox JS engine >>*does not* expose anything in the name slot (I already tested this). >> >> > >Yes it does; it exposes a blank string: > >function go() >{ > var f; > > f = function() { return 5; }; > > alert("typeof f.name == " + typeof f.name); >} > >...alerts "typeof f.name == string" not "typeof f.name == undefined". > >And the property is still read-only: > >function go() >{ > var f; > > f = function() { return 5; }; > > alert("f.name (1) == " + f.name); > > f.name = "flibbergibbett"; > > alert("f.name (2) == " + f.name); >} > >The second alert still shows the name as a blank string. >-- >T.J. Crowder >tj / crowder software / com > >On Jun 9, 5:50 am, Franck PORCHER <[EMAIL PROTECTED]> wrote: > > >>Yes Jeff, I'm using Firefox (Linux & FreeBSD plat-forms). >> >>And peering at the source code, one can see that Class.create() defines >>an explicit klass() function, hence the 'klass' display. >> >>Apparently, this property in not mutable. Something of a pain :-[ >> >>I will be reviewing prtotype's Class.create to see if we cannot achieve >>the same result with an anonymous function, for which Firefox JS engine >>*does not* expose anything in the name slot (I already tested this). >> >>Franck >> >>Franck Porcher, Docteur ès Sciences (Paris VI), Informatique théorique >> >>---------------------------------------------------------------------- >>SMART Technologies Les solutions intelligentes >>---------------------------------------------------------------------- >>Société de Services et d'Ingénierie en Informatique >>Solutions Open Source Linux & FreeBSD >>1995-2008 : Premier fournisseur en Polynésie française >> >>Tél: (689) 711 911 >>Email: fporcher(at)smartech(dot)pf >>Web: www(dot)smartech(dot)pf >>---------------------------------------------------------------------- >>"You can analyze the past but you have to design the future." >> >>Jeff Watkins wrote: >> >> >>>Off the top of my head, I'd guess you're using FireFox. I know the JS >>>engine in FireFox (SpiderMonkey) exposes the name of a function via >>>the `name` property, however, I don't know whether that property is >>>mutable. >>> >>> >>>My guess, from the behaviour of your code, is `name` is not a mutable >>>property. >>> >>> >>>On 8 Jun, 2008, at 9:06 PM, Franck PORCHER wrote: >>> >>> >>>>Hello, >>>> >>>> >>>>I have been trying for days o understand what I have missed. >>>> >>>> >>>>I have narrowed down the problem to this, where I create a simple >>>>class 'foo' that I extend to assign a private member 'name' set to 'FOO': >>>> >>>> >>>> var foo = Class.create({}); >>>> >>>> >>>> Object.extend( foo, { name : 'FOO' } ); >>>> >>>> >>>>Then : >>>> >>>> >>>> alert(foo.name) >>>> >>>> >>>>surprisingly displays >>>> >>>> >>>> klass >>>> >>>> >>>>(instead of FOO) >>>> >>>> >>>>Samething if I explicitely force the value to 'FOO' >>>> >>>> >>>> foo.name = 'FOO' >>>> >>>> >>>>Is there someone in the position to tell me what is going on, and why >>>>foo's private member 'name' does not hold its value. This does not >>>>happen if I choose another name for the private member. >>>> >>>> >>>>This has been most upsetting to me for days now, and I fail to >>>>understand what I am missing. >>>> >>>> >>>>So thank you to anyone who would help me understand my mistake if >>>>this is not a bug. >>>> >>>> >>>>Franck PORCHER >>>> >>>> >> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---