Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: what would you like to see in perl5.12?

by duff (Parson)
on Aug 19, 2007 at 19:48 UTC ( #633651=note: print w/replies, xml ) Need Help??

in reply to what would you like to see in perl5.12?

Personally, I'd like to see some of the features of Perl 6.

  • Real subroutine signatures
  • pipe-line operators (i.e. ==> and <==)
  • The reduce operator
  • Implicit variable declaration via twigil ($^foo)
  • Better support for OOP
  • Perl6 Regex
Et cetera.

It doesn't have to be perfect or exactly like Perl 6, as long as it provides a good cognitive bridge.

Replies are listed 'Best First'.
Re^2: what would you like to see in perl5.12?
by moritz (Cardinal) on Aug 19, 2007 at 19:54 UTC
    The Perl 6 features I'd like to see most in 5.12 is optional static typing, and real subroutine/method prototypes, a la

    sub repeat(Str $string, Int times)

    That makes code very much self-documentatory, and perhaps the partial statitic typing allows for more optimizations.

    Mind you, I have now idea if that's implementable with the current compiler/interpreter design - it's just a wish ;-)

      Bump the Moose suggestion and you can get close to that functionality now...
      use Moose; has 'string' => ( isa => 'Str', is => 'rw' ); has 'times' => ( isa => 'Int', is => 'rw' ); sub foo { my $self = shift; my ( $string, $times ) = ( $self->string, $self->times ); }

      Evan Carroll
        Would that work with sub signatures (not methods), and does it allow for the same kind of optimization that is possible if the compiler knows about the types?

      Why would anyone want to repeat the failed experiment of prefix types?  sub foo( Str $ref->[]{}, Int @arr[], Str $fun(Int bogus, Real otherbogus)) anyone?

        What makes you think that prefix types are a "failed experiment"?

        If you are talking about prototypes, that's hardly the same.

        Many staticly typed languages use it successfully, and if it stays optional I don't see a point against it.

        If you don't like the notation, you are of course free to omit the types - that's why I wrote optional static typing.

        BTW. I guess it would be Int @arr instead of Int @arr[].

        (Update: fixed thinko spotted by holli)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2021-10-22 13:20 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (85 votes). Check out past polls.