> Cc: [EMAIL PROTECTED]
> From: Piers Cawley <[EMAIL PROTECTED]>
> Date: Tue, 29 Oct 2002 09:36:12 +0000
> 
> Luke Palmer <[EMAIL PROTECTED]> writes:
> 
> >> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> >> From: Piers Cawley <[EMAIL PROTECTED]>
> >> Date: Tue, 29 Oct 2002 05:45:01 +0000
> >> X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/
> >> 
> >> Whilst I don't wish to get Medieval on your collective donkey I must
> >> say that I'm really not sure of the utility of the proposed infix
> >> superposition ops. I'm a big fan of any/all/one/none, I just think
> >> that
> >> 
> >>     one(any($a, $b, $c), all($d, $e, $f))
> >> 
> >> Is a good deal more intention revealing than the superficially
> >> appealing than
> >> 
> >>     ($a & $b & $c) ^ ( $d | $e | $f )
> >> 
> >> which takes rather more decoding. And if you *do* want to use such
> >> operators, surely you could just do 
> >> 
> >>     use ops ':superpositions';
> >> 
> >> in an appropriate lexical scope. Am I missing something?
> >
> > Uh huh.  This:
> >
> >    if $x == 1 | 3 | 6 { print "Small triangular" }
> >
> > I imagine it will not take long for these to sink in to people's
> > brains, and become used in very clever (and readable) ways.
> 
> So, if that's the way you're going to be using | in your code, just do
> C<use ops ':superposistions'> at the top of your file, in the same way
> as you do C<use strict> now. Or wrap it up in a policy file and do
> C<use policy '...'>. 

Heh, I don't C<use strict>... or C<warnings>.  :)

As far as frequency goes, though, I think C<use ops ':cbitwise'> would
would be more needed.  I mean I'm not sure of that: I'm using a sample
size of 1.  But that's my best guess.

You have a point.  The larger programs will make use of the
superpositions, and the smaller ones will make use of the bitwises.
Better to make the bigger programs use pragmas, and the little ones be
one-linerable.  But who knows, superpositions could often be useful in
scripts, too:

         find | perl -nle 'print join "\n", (s+\.++ | s/~$//).states'

Ok, that was a terrible example.  But you know what I mean....

> > Plus, a scripting (or, in the case of P6, high level) language with
> > such small bitwise ops gives me the shivers.  C, sure, they're common.
> > Perl, no, not usually.  I was even dissatisfied with them in C++,
> > which is a high- low-level language.
> 
> Catch is, they're there now and useful, especially when you start
> dealing with the outside world (C<O_RDWR | O_CREAT>  anyone?) 

Hopefully there won't be a need for that C<sysopen> stuff.  The I/O
system better be good enough to allow me to specify those flags
without "jumping through syntactc hoops" in terms of those ugly C
constants.

Plus, who says C<O_RDWR> and C<O_CREAT> can't just be constants, and
C<O_RDWR | O_CREAT>   a superposition of them.  It could mean the same
thing :)

Additionally, bitwise ops sure are useful... in a small amout of code.
Three or four lines per program.  That's why we're not getting rid of
them, just making them longer.  Superpositions will turn out to be
unimaginably handy, possibly used in 10% or 15% of the code, so they
get shorter names.

In my mind, Perl is stepping away from being a direct derivative of C;
rather, a derivative of Perl.  And it doesn't seem that the bitwise
ops are used enough anymore to get a single character.  If they get a
single character, surely =~ (~~) should have one.

Luke

Reply via email to