Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re (tilly) 4: Exegesis 2 - Perl 6

by tilly (Archbishop)
on May 16, 2001 at 14:50 UTC ( [id://80842]=note: print w/replies, xml ) Need Help??


in reply to (tye)Re2: Exegesis 2 - Perl 6
in thread Exegesis 2 - Perl 6

First you are right about the real reading of the win. But I think that their first implementation should just work without much worrying about optional optimizations at all. Attempts to have multiple things that could be scalars should be a second pass. Attempts to become smart about it (and not promote those ints to full scalars at the first moment) might take a while.

As for the third point, Larry will have to decide on a string concatenation operation other than the current. Personally I can learn a new concatenation operation fairly easily. As long as he doesn't pick +, I won't really care what he does there...

Replies are listed 'Best First'.
Re: Re (tilly) 4: Exegesis 2 - Perl 6
by eduardo (Curate) on May 16, 2001 at 20:09 UTC
    As for the third point, Larry will have to decide on a string concatenation operation other than the current. Personally I can learn a new concatenation operation fairly easily. As long as he doesn't pick +, I won't really care what he does there...

    This point seemed a bit confusing to me, being that so many languages already use the + operator for both addition and string concatenation, why would you be opposed to using + for this particular operation?
      It has to do with type systems.

      Perl's typing strategy has always been to type its core operations but not its variables. Then it will cast its variables as implied by its operations. The alternative that most other languages use is to type their variables but not their core operations.

      What this means is that in Perl you very rarely even have to think about the fact that "33" is different from 33. The following two are the same:

      $x = 33 + 55; # -> 88 $x = "33" + "55"; # -> 88, in other languages "3355".
      I think that, whether or not you think that Perl's type system is the best design, changing whether you have to think about the difference between strings and numbers would make Perl no longer Perl...

      Well, the biggest problem with using + for concatenate in Perl is that it introduces ambiguity. Consider:

      print "Enter a number: "; chomp(my $num1 = <STDIN>); print "Enter another number: "; chomp(my $num2 = <STDIN>); print "$num1 + $num2 is ", $num1 + $num2, "\n";

      Right now, the + means numerical addition so Perl converts those strings read in from STDIN to numbers, adds them, and converts the result back to a string to print it. In other words, now the operator (+ or .) imposes context (numeric or string) on its operands. Would you prefer having to do explicit type declarations or casting to provide context to the operator?

Log In?
Username:
Password:

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

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

    No recent polls found