Well, implementations actually differ here since there is no spec. So I would say "shouldn't" where you say "can". Best practices is to steer clear of them.
On Thu, Dec 5, 2013 at 8:07 PM, <[email protected]> wrote: > > > On Thursday, December 5, 2013 10:41:36 AM UTC-8, Kevin Millikin wrote: > >> On Thu, Dec 5, 2013 at 7:26 PM, <[email protected]> wrote: >> >>> >>> >>> On Wednesday, December 4, 2013 6:18:37 PM UTC-8, Vyacheslav Egorov wrote: >>>> >>>> > Here is a simple example of the issue from the JS point of view: >>>> >>>> You actually can't have a function declaration inside an if-statement >>>> but engines allow that for compat reasons. >>>> >>> >>> I do not understand "can't ... but engines allow": are there states >>> other than "can" and "cannot"? Maybe, given the following, you meant "I >>> recommend against function declarations inside of if-statements because it >>> leads to problems like those you hit, see below".? >>> >>> >> "Can't" == not permitted by the ES 5.1 spec. "but engines allow" == >> implementations do not follow the spec (surprised?). >> > > So that is "Can" ;-) > Not surprised, there are lots of things we can do in JS that don't work > well in some cases. IMO, that's one of the reasons it won: simple stuff is > simple even if complicated stuff is harder than it needs to be. > jjb > > -- > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to the Google Groups > "v8-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
