[Proto-Scripty] Re: evalScripts and functions

2009-05-27 Thread david
Hi ColinFine, It doesn't seem to me that these imply that there will be a different scope, but I'm not sure. I translate badlly my though (and I'm probably wrong). The created function in both case have the same scope (I think too). According to what you quote, I made the following test: var

[Proto-Scripty] Re: evalScripts and functions

2009-05-27 Thread david
Hi again ColinFine, Just had another test that make me understand what you quote: var _f=function(){return true}; var F; if(_f()===true) F=function(){alert('F true');} else F=function(){alert('F false');}; F(); var _ff=true; if((function(){return false})()===true) { function FF(){alert('FF

[Proto-Scripty] Re: evalScripts and functions

2009-05-26 Thread T.J. Crowder
Hi David, Could you please point me out where it is written, I've perhaps miss something. It's cleverly hidden on the docs for Ajax.Updater: http://prototypejs.org/api/ajax/updater A better place would (obviously) be on String#evalScripts, which someone helpfullly pointed out by opening a

[Proto-Scripty] Re: evalScripts and functions

2009-05-26 Thread ColinFine
On May 24, 3:24 pm, Michael mich...@michaelminella.com wrote:  However, in all of my scenarios, I've declared functions like this: var myFunction = function myFunction() {alert('hi');} and the calls to myFunction work just fine.  My question is...why does my way work?  According to the

[Proto-Scripty] Re: evalScripts and functions

2009-05-26 Thread david
@TJ, thanks for the links, as you say, it's cleverly hidden. Perhaps I'm not enough curious !! @ColinFine, According to Flanagan's book (section 8.1.2) the optional function- name in a function literal is not assigned to a variable, but apparently lives in a special namespace of its own that

[Proto-Scripty] Re: evalScripts and functions

2009-05-26 Thread ColinFine
On May 26, 12:41 pm, david david.brill...@gmail.com wrote: @ColinFine, According to Flanagan's book (section 8.1.2) the optional function- name in a function literal is not assigned to a variable, but apparently lives in a special namespace of its own that allows the function to

[Proto-Scripty] Re: evalScripts and functions

2009-05-25 Thread david
Hi Mickael, I just look at the prototype documentation, and did not find any note about: According to the Prototype documentation, you need to declare the function and assign it to a global variable: myFunction = function() {alert('hi');} Could you please point me out where it is written,

[Proto-Scripty] Re: evalScripts and functions

2009-05-25 Thread kangax
On May 24, 10:24 am, Michael mich...@michaelminella.com wrote: I understand how Prototype works with regards to the removal of script tags after evaling the results of an Ajax request. However, I was doing some research and am now starting to wonder why the way I declare functions works.