Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^4: [OT] Perl / Computer Science Science Fair Projects

by BrowserUk (Pope)
on Sep 09, 2008 at 20:35 UTC ( #710191=note: print w/replies, xml ) Need Help??

in reply to Re^3: [OT] Perl / Computer Science Science Fair Projects
in thread [OT] Perl / Computer Science Science Fair Projects

Also you can't use the let keyword unless you've explicitly declared that you're using version 1.7. ... which strikes me as a very annoying design choice.

Isn't that exactly the same design choice as the feature pragma in 5.10?

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^4: [OT] Perl / Computer Science Science Fair Projects

Replies are listed 'Best First'.
Re^5: [OT] Perl / Computer Science Science Fair Projects
by tilly (Archbishop) on Sep 09, 2008 at 20:55 UTC
    It is certainly similar, and was done for a similar reason.

    However the Perl version had better cause to do it (there is popular code in the wild which conflicts with Perl 5.10 features, whereas worries about functions named "let" are more theoretical), and did it with a language mechanism that is used by a lot of third party modules.

    But there are other significant differences. The JavaScript version has horrible action at a distance. If my library uses let, you have to know that when you load it in a different file. How to do it is not obvious. If I have multiple JavaScript snippets, I have to include that feature in each one. If I wish to inline some JavaScript in a tag, there is (as far as I know) absolutely no way for me to say that I want features turned on. (Yes, in autogenerated code it sometimes does make sense to put complex JavaScript in tags.) Furthermore if I'm a novice bitten by JavaScript's unusual scoping rule, there is no easy way for me to discover that workaround.

      If I wish to inline some JavaScript in a tag, there is (as far as I know) absolutely no way for me to say that I want features turned on.

      Specifying the default scripting language, from the HTML spec.

      (I'm not disagreeing with anything you said. I just thought you might be interested in this.)

        Nice looking spec. I just tried it in my Firefox 2. Based on the advice there I would expect one of the following two to cause script tags to default to version 1.7 but neither does:
        <META http-equiv="Content-Script-Type" content="application/javascript;version=1.7"> <META http-equiv="Content-Script-Type" content="text/javascript;version=1.7">
        (Either content version will work in a type tag to a script.)

        Given that failure, I am not going to rewrite my code sample to be inlined in a script tag. I'm just going to assume that it won't work.

      Way way off the OP topic but...

      Specifying the version in a single <script> tag doesn't seem all that big a deal to me. Load a single js file with that tag and then load all other external scripts programmatically with the XPCOM inteface or something like JSAN. That way everything else loaded specifies the same version, then add your inline script attributes and/or event handlers programmatically as well.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://710191]
and the sunlight beams...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2018-03-19 07:10 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (234 votes). Check out past polls.