Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Perl 6 will make amends (was:Perl's Bad Ideas)

by TheDamian (Vicar)
on Apr 07, 2002 at 00:20 UTC ( [id://157203]=note: print w/replies, xml ) Need Help??


in reply to Perl's Bad Ideas

Thanks for this highly useful thread.

I'd just like to point out that Perl 6 addresses almost every one of these dislikes (and even a few of clintp's favorite things):

The $#var syntax
Gone in Perl 6. It becomes @var.end or @var.last (probably the former, though I used the latter in E4).
Ranks right up there with $[
Gone in Perl 6. Replaced by an overloaded FETCH method on individual (or classes of) array-like objects.
no commas are allowed after the filehandle
As Dominus explained, using the comma isn't really a viable option. But whitespace as the syntactic marker for indirect objects probably wasn't the best choice either, in hindsight. Hence the use of the colon for that role in Perl 6.
$/, $\, $|, $", and $,
Gone in Perl 6. Replaced by methods on individual filehandles.
open FH, $file
Gone in Perl 6. Dominus gets his wish; it becomes $fh = open $file.
Implicit conversion of references to strings.
(Probably) gone in Perl 6. You'll need to explicitly stringify (using unary _).
v-strings
I don't know if Larry has considered their disposition yet.
pseudohashes
Gone in Perl 6. And going in Perl 5, for that matter.
$ used on single elements of hashes and arrays
Gone in Perl 6. Perl 6 variables never change sigils.
<> globbing
Gone in Perl 6. Use glob.
$;
(Probably) gone in Perl 6. Though the functionality might remain (as a per-hash or per-class method).
Symbolic references
Staying in Perl 6.
Perl's laissez faire approach to OO.
Staying in Perl 6. But being augmented by a second, B&D, OO mechanism.

BTW, those who are complaining are, for the most part, neither grinding axes nor bondage freaks. They are generally people with large commercial OO production systems to build, who would prefer not to have to jump through so many hoops to get compile-time checking, declarative attributes, pre- and post-conditions, strong encapsulation, etc. That is, they genuinely need all those valuable, scalable OO tools that Perl 5's laissez faire approach to OO trades off.

Punctuation.
Staying in Perl 6. But being simplified (e.g. sigils) and rationalized (e.g. fewer global punctuation vars).
Built-in networking and IPC functions
Staying in Perl 6. But becoming automagically loaded when used rather than bloating the core. (Hey, you want to be able to run perl on your Palm Pilot, don't you? ;-)
eval $string
Staying in Perl 6.
Globs
Gone in Perl 6. Every symbol has its own entry in some symbol table.
package variables.
Staying in Perl 6. And augmented by a third storage type: truly global variables.
local
Staying in Perl 6. Though the name isn't, since it just confuses people.
Punctuation variable names.
Staying in Perl 6. Though there will be fewer of them, and they'll be lexicals, not globals.
The entire approach to sockets in perl
I don't know Larry's thinking on this as regards Perl 6, except that the socket functions will also be autoloaded on demand, rather than mooching around the core. The interface certainly could do with some additional Perlification though...and some documenting.
chop
Very probably gone in Perl 6.
chomp
Possibly gone (as an independent function) in Perl 6. But Yuckfoo's wish is certainly granted: filehandles will be able to autochomp.
scalar @var
Evolving in Perl 6. Only returns the count in numerical contexts (but use of explicit @var.length encouraged instead). In non-specific scalar contexts, returns a reference to the array.

Replies are listed 'Best First'.
Re: Perl 6 will make amends (was:Perl's Bad Ideas)
by shotgunefx (Parson) on Apr 07, 2002 at 02:01 UTC
    Seeing everything is a closure, is the statement part of a conditional in the same block as the body itself?
    # For example while (my $el = pop @els){ # Body of loop } # Is it equivelant to this? { my $el = pop @els; { # Body of loop } } # Or this? { my $el = pop @els; # Body of loop }


    -Lee

    "To be civilized is to deny one's nature."
      ...is the statement part of a conditional in the same block as the body itself?

      No, the conditional is outside the block, both physically and logically (err...physiologically? ;-).

      Your example is equivalent to:

      my $el; while ($el = pop @els) { # Body of loop }

      BTW, in Perl 6, if and while (and the rest of the control structures) can be thought of as built-in functions. As if they were:

      sub while (BOOL $condition, &closure) {...} sub if (BOOL $condition, &closure) {...}

      That's why the conditional is not part of the block: it's an entirely separate argument to the control structure.

      And, yes, you'll be able to get the signature (a.k.a. prototype) of a control structure, and overload it, and redefine it (lexically).

      And you'll probably be able to write bad things like:

      if condition(), &call_me;

      and worse things like:

      &debug := { if BEGIN{$debug}, &^action }; # and later... debug { print "here" }
        Thanks for the enlightenment. Do you think there will be a mechanism to detect this? One thing I think would be nice would be able to tell if you are called in a control structure or not for lazy DWIM functions, like this findone { coderef } @array

        -Lee

        "To be civilized is to deny one's nature."
Re: Perl 6 will make amends (was:Perl's Bad Ideas)
by clintp (Curate) on Apr 07, 2002 at 04:03 UTC
    v-strings
    I don't know if Larry has considered their disposition yet.
    *whisper*Banish them... they were a terrible hack... develop a general purpose mechanism instead of this abomination...*whisper*
    Perl's laissez faire approach to OO.
    Staying in Perl 6. But being augmented by a second, B&D, OO mechanism.

    BTW, those who are complaining are, for the most part, neither grinding axes nor bondage freaks. They are generally people with large commercial OO production systems to build, who would prefer not to have to jump through so many hoops to get compile-time checking, declarative attributes, pre- and post-conditions, strong encapsulation, etc. That is, they genuinely need all those valuable, scalable OO tools that Perl 5's laissez faire approach to OO trades off.

    I've built several large (some very large) commercial OO production systems and never found Perl's OO lacking in any significant way. (For that matter I've built effective OO systems in C as well!) Most of the nits you listed can be solved with good design and mild discipline by the programmers. No whips, chains, or leather required.

    Personally, if I can use Perl's OO as I currently do I'll remain happy as a pig in mud.

      I've built several large (some very large) commercial OO production systems and never found Perl's OO lacking in any significant way.

      Well, sure. But not everyone is as smart, or as disciplined as you. And even if they were, many of them work in large programming teams with other people who certainly aren't as smart, or as disciplined as you.

      Such people really appreciate tools (and whips and chains) that make life simpler.

      Personally, if I can use Perl's OO as I currently do I'll remain happy as a pig in mud.

      Then you'll be wallowing contentedly for many years to come.

      On the other hand, I suspect that you'll also come to appreciate how much easier and quicker Perl 6 makes it to build classes. And that eventually you may even enjoy the whip of design-by-contract or the chain of proper encapsulation.

      C'mon! You know you want to! ;-)

Re: Perl 6 will make amends (was:Perl's Bad Ideas)
by demerphq (Chancellor) on Apr 15, 2002 at 14:43 UTC
    $/, $\, $|, $", and $,

    Gone in Perl 6. Replaced by methods on individual filehandles.

    All (sniff) good things must come to a (sniff) end eh?

    Ill miss those ones I tell yah. Its sad to see such friendly variables consigned to the waste basket of history... Sniff.

    Globs

    Gone in Perl 6. Every symbol has its own entry in some symbol table.

    Thank you thank you! Ive been working on a new dumper module recently and those dang globs caused my code size to go up by about 30%.

    Yves / DeMerphq
    ---
    Writing a good benchmark isnt as easy as it might look.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-03-19 08:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found