develooper Front page | perl.perl6.language | Postings from October 2002

Re: labeled if blocks

Thread Previous | Thread Next
From:
Larry Wall
Date:
October 28, 2002 14:50
Subject:
Re: labeled if blocks
Message ID:
Pine.LNX.4.44.0210281440140.18296-100000@london.wall.org
On Tue, 29 Oct 2002, Angel Faus wrote:
: Could we please, please, please have bitwise operators be out of the 
: core. We expect that they are not going to be used by the average 
: user, so it looks fair to apply the ultimate negative huffman 
: enconding: they need to be specially required.
: 
: A simple "use bitwise" would be ok. That would provide a proper 
: manpage to explain the meta-operators thing, and would shorten the 
: main list, which is something that we desperatelly need.

Fine by me.  Could force people to declare hyper and super, for all that...

: On other order of things: if it is about providing context to an 
: operation, wouldn't an adverb be more natural?
:
: So it would be something like this:
: 
: $c = $a | $b;        # superposition
: $c = $a | $b : int;  # integer bitwise
: $c = $a | $b : str;  # char bitwise
: $c = $a | $b : bool; # bool bitwise

Has the "long term" problem, not to be confused with the long-term problem...

Also has the "oh by the way" problem we're trying to get away from with
regex modifiers.

: This can be expanded to other context-requiring cases:
: 
: $c = $a / $b;        # float division
: $c = $a / $b : int;  # integer division
: 
: Admitedly, it's more verbose. But again this is Huffman encoding at 
: use.

As long as we're admitting things, I'll admit that

    $c = $a +/ $b;  # integer division

looks pretty weird too.  But in this case, the historical

    $c = int($a / $b);  # integer division

at least ends up with the right semantics (by accident).

: Or, speaking aloud, we could move the adverb just along the operator, 
: tying them together visually:
: 
: $c = $a |:int $b;
: $c = $a &:str $b;
: 
: But honestly, that looks weird.

And is essentially the same thing as 

    $c = $a +| $b;
    $c = $a ~& $b;

only with the context on the other end.

Larry


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About