Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^6: My questions: new to perl

by JavaFan (Canon)
on Mar 14, 2011 at 21:04 UTC ( #893162=note: print w/replies, xml ) Need Help??


in reply to Re^5: My questions: new to perl
in thread My questions: new to perl

Did you deliberately misquote me? I specifically said version 5.12 of the interpreter wasn't sufficient.

Since 5.10, Perl has been changing in backwards incompatible ways. To get the latest version of the language, you need to request it using use 5.010; or similar.

Did you mean you found a convoluted way (which I did not understand) to describe use 5.012;? If you meant that, why didn't you say so?

Not that I agree use 5.YYY; switches to different versions of the language. Or that without using use 5.XXX; you won't be getting any of the latest version. *Most* changes of the language you'll get with, or without use 5.XXX. (Smart match for instance, all of the regexp changes, new versions of Unicode, etc).

Either you didn't express yourself properly, or you just advocated that strict var checks be moved to the linter.
First of all, strictness checks aren't warnings. Second, due to exporting, one actually needs to run code to know what's being exported - and hence whether strict vars will complain or not.

Replies are listed 'Best First'.
Re^7: My questions: new to perl
by ikegami (Pope) on Mar 14, 2011 at 22:09 UTC

    I agree that simply using perl 5.12 gets you most of Perl 5.12. Specifically, you get bug fixes and features that aren't backwards incompatible. For the rest of the features, you need the pragma.

    Did you mean you found a convoluted way (which I did not understand) to describe use 5.012;?

    Saying that use 5.012; causes the Perl 5.12 language to be used is hardly convoluted. But no, I wasn't describing use 5.012;, I was talking about strict in Perl 5.12.

    *Most* changes of the language you'll get with, or without use 5.XXX. (Smart match for instance, all of the regexp changes, new versions of Unicode, etc).

    Actually, some of the regex and unicode changes require use 5.xxx; because they aren't backwards compatible.

    Second, due to exporting, one actually needs to run code to know what's being exported

    Granted, I forgot that.

    Let's say it was impossible to export variables. Would you still say that use strict 'vars'; should be done by a linter instead of Perl itself?

    The point is I think your condition for deciding if something should be done by a linter instead of perl is insufficient. This renders your argument unconvincing.

      But no, I wasn't describing use 5.012;, I was talking about strict in Perl 5.12.
      Now I'm utterly confused, and I've no longer the faintest clue what you're trying to say. If I run the binary that I build with the source that comes in the perl 5.12 tarball, I only get strictness by either 1) doing use strict;, and 2) use 5.012;. 1) certainly isn't new to 5.12, and you seem to disagree with me on 2). Can you show some code that shows strict on by default, with the use 5.012; clause?
      Actually, some of the regex and unicode changes require use 5.xxx; because they aren't backwards compatible.
      Could you elaborate on this one? Which regexp or Unicode feature is only available after doing a use 5.012;? According to man feature, the only features are:
         The switch feature
             "use feature 'switch'" tells the compiler to enable the Perl 6
             given/when construct.
      
             See "Switch statements" in perlsyn for details.
      
         The say feature
             "use feature 'say'" tells the compiler to enable the Perl 6 "say"
             function.
      
             See "say" in perlfunc for details.
      
         the state feature
             "use feature 'state'" tells the compiler to enable "state" variables.
      
             See "Persistent Private Variables" in perlsub for details.
      
         the unicode_strings feature
             "use feature 'unicode_strings'" tells the compiler to treat all strings
             outside of "use locale" and "use bytes" as Unicode. It is available
             starting with Perl 5.11.3.
      
             See "The "Unicode Bug"" in perlunicode for details.
      
      Now, checking perlunicode, it's suggested that if the unicode_strings feature is in effect, Unicode semantics will be in effect on all strings (as long as use locale and use bytes aren't in effect), in particular when it comes to /\w/ and lc/uc. But that doesn't actually seem to work:
      $ perl -wE 'my $foo = ""; say $foo =~ /\w/ || 0; say uc $foo' 0 $ perl -wE 'my $foo = ""; utf8::upgrade $foo; say $foo =~ /\w/ || 0; +say uc $foo' 1 $
      Note though that I wasn't thinking of this feature when I was talking about Unicode changes - I was thinking about Perl 5.12 implementing Unicode 5.2 (as opposed to Unicode 5.0.0 in 5.10).
      Let's say it was impossible to export variables. Would you still say that use strict 'vars'; should be done by a linter instead of Perl itself?
      Probably not. The problem is that "use strict 'vars';" creates compilation errors. Linters typically don't check for that - they warn about valid, but (for some value of) questionable constructs. qw[hello, world] is certainly valid, and some think it to be questionable.

        Now I'm utterly confused, and I've no longer the faintest clue what you're trying to say.

        Ask a twisted question, get a twisted answer.

        you seem to disagree with me on 2).

        Nope.

        But that doesn't actually seem to work:

        Not for regex, unfortunately, but it does for uc

        $ perl -CS -wE'no feature qw( unicode_strings ); $_="\xEB"; utf8::dow +ngrade($_); say /\w/||0; say uc;' 0 $ perl -CS -wE'no feature qw( unicode_strings ); $_="\xEB"; utf8::upg +rade($_); say /\w/||0; say uc;' 1 $ perl -CS -wE'use feature qw( unicode_strings ); $_="\xEB"; utf8::dow +ngrade($_); say /\w/||0; say uc;' 0 $ perl -CS -wE'use feature qw( unicode_strings ); $_="\xEB"; utf8::upg +rade($_); say /\w/||0; say uc;' 1

        I think you had UTF-8 source code without using use utf8;.

        I was thinking about Perl 5.12 implementing Unicode 5.2 (as opposed to Unicode 5.0.0 in 5.10).

        Yes, you get that for free.

        $ corelist -a Unicode Unicode was first released with perl v5.6.2 v5.6.2 3.0.1 v5.8.0 3.2.0 v5.8.1 4.0.0 v5.8.2 4.0.0 v5.8.3 4.0.0 v5.8.4 4.0.1 v5.8.5 4.0.1 v5.8.6 4.0.1 v5.8.7 4.1.0 v5.8.8 4.1.0 v5.8.9 5.1.0 v5.9.0 4.0.0 v5.9.1 4.0.0 v5.9.2 4.0.1 v5.9.3 4.1.0 v5.9.4 4.1.0 v5.9.5 5.0.0 v5.10.0 5.0.0 v5.10.1 5.1.0 v5.11.0 5.1.0 v5.11.1 5.1.0 v5.11.2 5.1.0 v5.11.3 5.2.0 v5.11.4 5.2.0 v5.11.5 5.2.0 v5.12.0 5.2.0 v5.12.1 5.2.0 v5.12.2 5.2.0 v5.13.0 5.2.0 v5.13.1 5.2.0 v5.13.2 5.2.0 v5.13.3 5.2.0 v5.13.4 5.2.0

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2019-03-26 17:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How do you Carpe diem?





    Results (125 votes). Check out past polls.

    Notices?