Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by tilly (Archbishop)
on Sep 09, 2008 at 20:55 UTC ( [id://710193]=note: print w/replies, xml ) Need Help??


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

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.

  • Comment on Re^5: [OT] Perl / Computer Science Science Fair Projects

Replies are listed 'Best First'.
Re^6: [OT] Perl / Computer Science Science Fair Projects
by ikegami (Patriarch) on Sep 09, 2008 at 21:06 UTC

    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.

Re^6: [OT] Perl / Computer Science Science Fair Projects
by Anonymous Monk on Sep 11, 2008 at 05:22 UTC

    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 @mozilla.org/moz/jssubscript-loader 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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://710193]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-23 14:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found