Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Re: NO PERL 6

by Ovid (Cardinal)
on Dec 09, 2002 at 16:06 UTC ( #218564=note: print w/replies, xml ) Need Help??

in reply to Re: NO PERL 6
in thread NO PERL 6

Your points:

...parrot seems frivolous and unnecessary

I am glad we're making a platform that can run different languages. Parrot has the potential to pull much of the dynamically typed language community together and can give it a solid footing. If there is a great Python library that I want to use, I can run it through Parrot and use it from Perl without much effort. You can also use Parrot assembly directly from Perl and get the performance benefits without being forced to learn C. And the JIT compiler will be a godsend for many programmers. It will be wonderful to compile and distribute an actual application, rather than many of the hodgepodges that we have now.

the use of . instead of -> and _ instead of . utterly disgusts me.

The underscore is there because the dot operator no longer represents concatenation. As for the dot operator, once I became used to the change, I was happy for it. First of all, it represents less punctuation. Whether justified or not, many people gripe about Perl's excessive and sometimes confusing punctuation and this will help to alleviate that concern. Of course, if one is going to reduce punctuation, one should do it for commonly done things. The arrow operator is one of those things and since everyone else already uses the dot, it's a pretty natural conversion.

Incidentally, take a look at some VB6 or VBScript code and compare it to the code written for Win32 modules. Quite often, lines of code are identical, except for the difference between the arrow and the dot. This makes less of a barrier for people coming to Perl. We shouldn't be here to be elitist. We should be here because Perl Gets Things Done. If switching from an arrow to a dot improves that and makes Perl seem less intimidating, so be it.

Returning to the punctuation problem, the shift from arrow to dot is part of the overall plan to extend Perl yet make it easier to learn. This has led to standardizing the sigils of variables so that they denote type instead of what the variable is returning. For instance:

# Perl 6 (possible typos ahead) my @array = qw(foo bar baz this that the other thing); my $word = @array[0]; # a single value my @words = @array[5,6,7]; # an array slice

The above syntax is already what many new programmers expect out of Perl5. We have to violate their expectations to explain the difference between accessing a single array value or an array slice. Further, the following monstrosities in Perl 5 can hopefully go away:

@_[1..$#_]; # all but the first element of an argument list @{$var}{qw(foo bar)}; # a hash slice of a hash reference

(out of time and need to get to work ... I'm sure others can come up with better examples and show how they'll look in Perl6)


New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)

Replies are listed 'Best First'.
Re: Re: Re: NO PERL 6
by elusion (Curate) on Dec 09, 2002 at 16:47 UTC
    Just a quick note. _ is no longer being used for the concatenation operator, now it's ~.
    "hello " ~ "world"; $str ~= "!!!"; # which is different from =~ (if =~ isn't changed)
    Also, the "." syntax has one big advantage: topics. When calling a method on the topic ($_ (also $self in OO -- see article on, a lone dot looks much better than a lone arrow. .method vs. ->method And it fits my brain better for assignment.

    elusion :

      Oh man. This ~= vs =~ should quickly catapult to the "most common dumb-ass Perl coding mistake" position when Perl 6 is released.

        Which is why the "smart-match" operator (what the =~ regex binding operator is changing to) is changing to ~~ when/if the concatination operator becomes ~.

        Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

        I don't see this as any worse than the silent errors created by typing $f =~ $f when what you meant was $f = ~$f? Eg.

        c:\test>perl -e "for $f ( @a = qw/0 1 2.3 fred . ''/) { print $f =~ $f +, '-', $f = ~$f, $/; }" 1-╧ 1-╬ 1-═╤╠ 1-ÖìÜ¢ 1-╤ 1-╪╪

        Of course, it could compound the problem.

        Personally, it seems that the search for an alternative to '.' for string catenation is avoiding the obvious choice for sake of not being "me too".

        If the use of '+' and '+=' for this is undesirable for syntactic reasons, I wonder if its actually necessary to have a catenation char--why not simply use abuttment? Is there any situation when

        $string = "dsadfkjasdkhakhds dhf sahd fsd " "sdshsa ashjashjas asjhasjhasdh"; $str = 'Fred is ' $num " years old\n";

        would be ambiguous?

        For an alternative to $str .= $more how about $str "= $more;?

        Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
        Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
        Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
        Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.

        Hmmm, is that worse than += vs =+ and -= vs =- which is already possible in Perl (as well as in C and a bunch of other languages)?


        We don't need a concatenation operator at all. Just use the new-improved string interpolation: "$(expression-1)$(expression-2)". In fact, since most explicit cases of concatenation are for when interpolation isn't good enough (e.g. an expression not a single variable) this will take care of most of today's uses.

        When you want to make it clear that you're concatenating something, why have a small syntax? Seems to me you are asking for big syntax, to emphasize the thing. So just use join with an empty first argument (no separate cat function needed.


        I started a new top-level thread here. This is already too deep!

        Edit by tye to fix link

Re: Re: Re: NO PERL 6
by batkins (Chaplain) on Dec 10, 2002 at 00:31 UTC
    now, wait just a tick. are you saying that parrot will allow the use of non-perl libraries and that it will allow true executables (not perl2exe or perlapp packages, but real exe's)? if so, then i just might have to retract my anti-parrot sentiments.

    but i'm holding my ground on the symbols issue. :)

      Non-perl libraries yes. You can do it now if you're so inclined--the code to handle it dynamically (i.e. without having to build an extension to wrap the library) is in the repository now.

      You should also be able to build standalone executables, though whether there's any speed win is up in the air. (And you can certainly write code such that you can't have a standalone executable if you so choose...)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://218564]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2017-01-21 20:02 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (185 votes). Check out past polls.