Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Trying to make perl suck less again

by ysth (Canon)
on Dec 23, 2007 at 02:41 UTC ( [id://658732]=note: print w/replies, xml ) Need Help??


in reply to Trying to make perl suck less again

feature is a lexically scoped pragma; there is no way (nor should there be) to turn it on everywhere.

But to enable it in every module that uses Moose is easy: just add feature->import(":5.10") if $] >= 5.010; in Moose::import, the same as is done for the strict and warnings pragmas (sans conditional). And a use if $] >= 5.010, "feature", ":5.10"; at the top of Moose.pm.

But this seems like a silly thing to do; I presume the real Moose distribution won't integrate a change like that, for the same reason that features aren't automatic in the first place: backwards compatibility.

It would make more sense to have a module of your own used by everything you write that loads both Moose and 5.10 features (untested):

package EvanPerl; use strict; use warnings; use Moose; use if $] >= 5.010, "feature", ":5.10"; sub import { feature->import(":5.10") if $] >= 5.010; goto &Moose::import; # can't just call Moose->import since it need +s to know the "correct" caller. } 1;

Replies are listed 'Best First'.
Re^2: Trying to make perl suck less again
by EvanCarroll (Chaplain) on Dec 23, 2007 at 07:29 UTC
    Moose doesn't have to be backwards compatible, and quite frankly it is stupid perl is to such an ape shit insane extent - especially being Perl 6's state. If you use Moose, the package that includes Moose should use 5.10 features. It is the very job of Moose's to eliminate cruft, after all -- it's just regular perl code, that makes perl more bearable. Having to tell Perl your code isn't retardedly esoteric, and thus can use new features, is surely an easy target for Moose. And v5.10 broke stuff anyway right? Without going into the minor things I'm sure it broke, it removed the deprecated pseudohashes...

    IIRC the strongest reason to keep Moose out of the CORE amongst other stupid modules that compete to make perl-suck-less, was that Moose wanted to develop at a higher speed than that of CORE, and that people acknowledge it might break backwards compatibility.

    Every few major releases of Moose have broken something, somewhere for me. However, I waste substantially less time finding and fixing them than I did hitting my head over retarded design decisions that predate Moose. And more often than not, the new functionality Moose includes with every major release quickly laps the amount of time I waste when Moose is broken from upgrade.

    Ignore those that would stifle development because they refuse to risk breaking compatibility. programmer_conservatives--


    Evan Carroll
    www.EvanCarroll.com
      Thanks for explaining. I didn't know Moose regularly breaks compatibility. That's a little scary, if (as I believed to be the case) it is used by a number of CPAN authors, all of whom will be upgrading on their own schedules. Oh well.

      Update: the above was intended to be sarcastic. I assume that even if Evan's assertion that Moose has broken BC is true, it was accidental, not intentional.

        Moose regularly breaks compatibility? Perhaps someone should tell its authors, who claim in Moose::Cookbook::FAQ that

        The external API [...] is very stable and any changes will be 100% backwards compatible.
        (emphasis theirs). Sounds to me like a module that thinks backwards-compatibility is important...

        Frankly I cannot agree with EvanCarroll's recent post above. Maybe he lives in a bleeding-edge paradise where he can recklessly break his code all the time and laugh it off, but some of us work in real-world environments where breaking things is not an option. The only reason I can use Perl at all is that I can write code that will run on versions back to 5.6.1 (and it's only recently that we got rid of the last server that couldn't be upgraded beyond 5.005). This means avoiding cruft (no pseudo-hashes etc) -- but it also means avoiding new features.

        Basically, any CPAN module that forced 5.10 semantics when running under 5.10 -- as EvanCarroll appears to be proposing for Moose -- will simply not be an option for me or any of the many other Perl hackers in my position. Maybe prizing backwards-compatibility so highly seems "ape shit insane" to some people, but to me the "ape shit insane" thing would be a module that changed the semantics of my code depending on the version of Perl I ran it with.

        A reply falls below the community's threshold of quality. You may see it by logging in.
      A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-24 23:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found