As you were saying pre-processing I thought it was having a condition choosing once between two functions instead of one function with a condition in it...
On Fri, Aug 26, 2011 at 2:02 PM, Diego Perini <[email protected]> wrote: > Xavier, > no hoisting in your example. Just a variable declaration ("addEvent") > to reference a function. > > After that, "addEvent" is referencing one of the two function using > different event models depending on the availability of > "window.addEventListener". > > > Diego > > > On Fri, Aug 26, 2011 at 10:54 AM, Xavier MONTILLET > <[email protected]> wrote: >> Is hoisting doing this: >> var addEvent = window.addEventListener ? function ( e, s, f ) { >> e.addEventListener( s, f ); >> } : function ( e, s, f ) { >> e.attachEvent( 'on' + n, f ); >> }; >> ? >> >> On Fri, Aug 26, 2011 at 10:37 AM, Hsu Ping Feng <[email protected]> >> wrote: >>> Maybe just like a metaphor for hoist. But in section 10.1.3 "Variable >>> Instantiation" of ecma3, the order to add things to scope chain is >>> FunctionDeclaration then Variable. >>> >>> 2011/8/26 Nick Morgan <[email protected]> >>>> >>>> On 26 August 2011 04:43, RobG <[email protected]> wrote: >>>> > >>>> > >>>> > On Aug 23, 11:06 pm, Nick Morgan <[email protected]> wrote: >>>> > [...] >>>> >> The function declaration `createUniqueId` is effectively hoisted to >>>> >> the top of the script, so it actually *is* defined before you add the >>>> >> `counter` property to it. >>>> >>>> > Not a big fan of that expression (hoisted). It might be what seems to >>>> > be happening but what actually happens is that variable and function >>>> > declarations (among other things) are processed first when an >>>> > execution context is entered and before any code is executed. >>>> > >>>> >>>> Even Brendan Eich uses the term 'hoisting'. It might not be in any >>>> spec, but it's used consistently in discussions of function >>>> pre-processing. >>>> >>>> > A better term (IMHO of course) would be "pre-processed", because not >>>> > only does it infer that those parts of the code are processed before >>>> > any other, but also actually describes what's happening. Hoisting >>>> > makes me think of flags, which is unrelated and inconsistent. >>>> > >>>> > -- >>>> > Rob >>>> > >>>> > -- >>>> > To view archived discussions from the original JSMentors Mailman list: >>>> > http://www.mail-archive.com/[email protected]/ >>>> > >>>> > To search via a non-Google archive, visit here: >>>> > http://www.mail-archive.com/[email protected]/ >>>> > >>>> > To unsubscribe from this group, send email to >>>> > [email protected] >>>> > >>>> >>>> >>>> >>>> -- >>>> Nick Morgan >>>> http://skilldrick.co.uk >>>> @skilldrick >>>> >>>> Save our in-boxes! http://emailcharter.org >>>> >>>> -- >>>> To view archived discussions from the original JSMentors Mailman list: >>>> http://www.mail-archive.com/[email protected]/ >>>> >>>> To search via a non-Google archive, visit here: >>>> http://www.mail-archive.com/[email protected]/ >>>> >>>> To unsubscribe from this group, send email to >>>> [email protected] >>> >>> >>> >>> -- >>> AUFKLÄRUNG ist der Ausgang des Menschen aus seiner selbstverschuldeten >>> Unmündigkeit. Unmündigkeit ist das Unvermögen, sich seines Verstandes ohne >>> Leitung eines anderen zu bedienen. Selbstverschuldet ist diese Unmündigkeit, >>> wenn die Ursache derselben nicht am Mangel des Verstandes, sondern der >>> Entschließung und des Mutes liegt, sich seiner ohne Leitung eines andern zu >>> bedienen. Sapere aude! Habe Mut, dich deines eigenen Verstandes zu bedienen! >>> ist also der Wahlspruch der Aufklärung. >>> >>> -- >>> To view archived discussions from the original JSMentors Mailman list: >>> http://www.mail-archive.com/[email protected]/ >>> >>> To search via a non-Google archive, visit here: >>> http://www.mail-archive.com/[email protected]/ >>> >>> To unsubscribe from this group, send email to >>> [email protected] >>> >> >> -- >> To view archived discussions from the original JSMentors Mailman list: >> http://www.mail-archive.com/[email protected]/ >> >> To search via a non-Google archive, visit here: >> http://www.mail-archive.com/[email protected]/ >> >> To unsubscribe from this group, send email to >> [email protected] >> > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected] > -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
