Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

down with err, up with dor

0 views
Skip to first unread message

Ricardo SIGNES

unread,
Sep 3, 2007, 1:23:53 PM9/3/07
to perl5-...@perl.org
Porters,

We're rapidly getting toward a real 5.10, when all the stuff that's been
getting worked on will be released to the world and more or less set in stone
for the next ten years. If there are lingering mistakes, we should really try
to fix them now, rather than 2017, by which time I assume we will all be
sipping pina coladas in a global socialist paradise.

I was very happy to see the mistake of assertions fixed. I just have one more
Big Mistake that I'd like to see fixed before I can start working on perfecting
my pina colada mix.

'err' is just about the worst name possible for low-precedence //. I guess
some sort of fifty-character string of gibberish mixing 1 and l would be worse.
err is pretty bad, though.

Its meaning is entirely unclear to anyone who is not already inside the Perl
Echo Chamber. When you're showing a non-Perl programmer some perl code that
contains err, what will you say when he asks, "Why is that called err?" I
guess you can say, "Because it sort of sounds like or. Get it?"

(I've *just* asked Larry, in IRC, what the reasoning behind 'err' as a name is,
but I'm waiting on a response and too impatient to not send this right now.)

Not only is the actual meaning not very tied to the name, but another meaning
seems quite tied to it: errors. I mean, err actually *means* to make an error!
I think that's what we're doing by using "err" to mean //-but-low-precidence.

I've heard tell that we're not using "dor" because Larry doesn't like it, and
Larry gets the final say. I think "dor" is an excellent name, because it
matches up with or and xor. Let's say it's right out, though... there must be
some third alternative that isn't confusing like err or Larry-displeasing like
dor.

Alternatives from the top of my head: default, ifundef, els, uor. Maybe there
are other, better alternatives. (I really do like 'dor', though.)

--
rjbs

Andy Armstrong

unread,
Sep 3, 2007, 1:30:35 PM9/3/07
to Ricardo SIGNES, perl5-...@perl.org
On 3 Sep 2007, at 18:23, Ricardo SIGNES wrote:
> Alternatives from the top of my head: default, ifundef, els, uor.
> Maybe there
> are other, better alternatives. (I really do like 'dor', though.)

'maybe' ? :)

--
Andy Armstrong, hexten.net

H.Merijn Brand

unread,
Sep 3, 2007, 1:47:37 PM9/3/07
to perl5-...@perl.org
On Mon, 3 Sep 2007 13:23:53 -0400, Ricardo SIGNES
<rjbs-p...@lists.manxome.org> wrote:

> Porters,
>
> We're rapidly getting toward a real 5.10, when all the stuff that's been
> getting worked on will be released to the world and more or less set in stone
> for the next ten years. If there are lingering mistakes, we should really try
> to fix them now, rather than 2017, by which time I assume we will all be
> sipping pina coladas in a global socialist paradise.
>
> I was very happy to see the mistake of assertions fixed. I just have one more
> Big Mistake that I'd like to see fixed before I can start working on perfecting
> my pina colada mix.
>
> 'err' is just about the worst name possible for low-precedence //. I guess
> some sort of fifty-character string of gibberish mixing 1 and l would be worse.
> err is pretty bad, though.

I don't really care either way, as long as I can have it available.

The one thing that would pro for 'err' is that it is in my dor patch for
5.8.x since day one.

I did use 'err'. Can't remember when, but I'm sure some shit will hit the fan
when I run that script on 5.10 :) That's what testing is for, right?

> Its meaning is entirely unclear to anyone who is not already inside the Perl
> Echo Chamber. When you're showing a non-Perl programmer some perl code that
> contains err, what will you say when he asks, "Why is that called err?" I
> guess you can say, "Because it sort of sounds like or. Get it?"
>
> (I've *just* asked Larry, in IRC, what the reasoning behind 'err' as a name is,
> but I'm waiting on a response and too impatient to not send this right now.)
>
> Not only is the actual meaning not very tied to the name, but another meaning
> seems quite tied to it: errors. I mean, err actually *means* to make an error!
> I think that's what we're doing by using "err" to mean //-but-low-precidence.
>
> I've heard tell that we're not using "dor" because Larry doesn't like it, and
> Larry gets the final say. I think "dor" is an excellent name, because it
> matches up with or and xor. Let's say it's right out, though... there must be
> some third alternative that isn't confusing like err or Larry-displeasing like
> dor.
>
> Alternatives from the top of my head: default, ifundef, els, uor. Maybe there
> are other, better alternatives. (I really do like 'dor', though.)
>


--
H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.9.x on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.0 & 10.2, AIX 4.3 & 5.2, and Cygwin. http://qa.perl.org
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org
http://www.goldmark.org/jeff/stupid-disclaimers/

Ovid

unread,
Sep 3, 2007, 1:52:37 PM9/3/07
to P5P
--- Ricardo SIGNES <rjbs-p...@lists.manxome.org> wrote:

> I've heard tell that we're not using "dor" because Larry doesn't like
> it, and
> Larry gets the final say. I think "dor" is an excellent name,
> because it
> matches up with or and xor. Let's say it's right out, though...
> there must be
> some third alternative that isn't confusing like err or
> Larry-displeasing like
> dor.

I rather suspect this won't be changed at this late of date, but let me
just say:

++

I like 'dor'; 'err' is just wrong.

Cheers,
Ovid

--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Perl and CGI - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog - http://use.perl.org/~Ovid/journal/

Marvin Humphrey

unread,
Sep 3, 2007, 2:11:24 PM9/3/07
to Andy Armstrong, Ricardo SIGNES, perl5-...@perl.org

On Sep 3, 2007, at 10:30 AM, Andy Armstrong wrote:

> On 3 Sep 2007, at 18:23, Ricardo SIGNES wrote:
>> Alternatives from the top of my head: default, ifundef, els, uor.
>> Maybe there
>> are other, better alternatives. (I really do like 'dor', though.)
>
> 'maybe' ? :)

I suggest 'mistake'. :)

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/


Marvin Humphrey

unread,
Sep 3, 2007, 2:01:57 PM9/3/07
to Ricardo SIGNES, perl5-...@perl.org

On Sep 3, 2007, at 10:23 AM, Ricardo SIGNES wrote:

> Its meaning is entirely unclear to anyone who is not already inside
> the Perl
> Echo Chamber.

Hmm, I'd thought I was inside the Perl Echo Chamber...

> When you're showing a non-Perl programmer some perl code that
> contains err, what will you say when he asks, "Why is that called
> err?" I
> guess you can say, "Because it sort of sounds like or. Get it?"

I was confused by 'err' until I saw this post.

I assumed it had something to do with errors.

Yitzchak Scott-Thoennes

unread,
Sep 3, 2007, 2:55:54 PM9/3/07
to H.Merijn Brand, perl5-...@perl.org
On Mon, September 3, 2007 10:47 am, H.Merijn Brand wrote:
> On Mon, 3 Sep 2007 13:23:53 -0400, Ricardo SIGNES
>> I was very happy to see the mistake of assertions fixed.

And I was not. There were problems with the implementation, but
not with the basic feature (the ability to mark a sub so that calls
to it could be optionally elided at compile time). The suggested
"replacement" was something completely different and, in my mind,
horrifically less useful.

>> 'err' is just about the worst name possible for low-precedence //. I
>> guess some sort of fifty-character string of gibberish mixing 1 and l
>> would be worse. err is pretty bad, though.

err is perfect. Any keyword you come up with (short of horrors like
'short_circuit_if_defined') isn't going to describe the feature;
that's what the doc is for. But err describes what I think will be
the typical use: to handle an error condition from an expression
where 0 or "" indicates success but undef indicates an error:

my $bytes_read = try_to_buffer_some_data() err die "read error: $!"

> The one thing that would pro for 'err' is that it is in my dor patch for
> 5.8.x since day one.

And isn't there a distribution (FreeBSD?) that made bold to use your
patch? I guess you could say they get what they deserve if it changes.


Abigail

unread,
Sep 3, 2007, 5:53:07 PM9/3/07
to perl5-...@perl.org
On Mon, Sep 03, 2007 at 01:23:53PM -0400, Ricardo SIGNES wrote:
> Porters,
>
> We're rapidly getting toward a real 5.10, when all the stuff that's been
> getting worked on will be released to the world and more or less set in stone
> for the next ten years. If there are lingering mistakes, we should really try
> to fix them now, rather than 2017, by which time I assume we will all be
> sipping pina coladas in a global socialist paradise.
>
> I was very happy to see the mistake of assertions fixed. I just have one more
> Big Mistake that I'd like to see fixed before I can start working on perfecting
> my pina colada mix.
>
> 'err' is just about the worst name possible for low-precedence //. I guess
> some sort of fifty-character string of gibberish mixing 1 and l would be worse.
> err is pretty bad, though.

Yes.

But, frankly, p5p isn't the place to discuss it. The name 'err' comes
from perl6. And AFAIK, it's pretty fixed there.

For me, '//' is pronounced 'dor'. And I can live with 'err'.

> Its meaning is entirely unclear to anyone who is not already inside the Perl
> Echo Chamber. When you're showing a non-Perl programmer some perl code that
> contains err, what will you say when he asks, "Why is that called err?" I
> guess you can say, "Because it sort of sounds like or. Get it?"
>
> (I've *just* asked Larry, in IRC, what the reasoning behind 'err' as a name is

> but I'm waiting on a response and too impatient to not send this right now.)

Yves and I talked to Larry last week, and he said we're basically free to
do with perl5 as we pleased, but he prefers not to be inconsistent with
perl6 if possible.

Therefore, my vote is to keep 'err'. I don't like it that much, but I doubt
I'll use 'err' often enough to be really bothered with.

Abigail

David Nicol

unread,
Sep 3, 2007, 9:42:40 PM9/3/07
to perl5-...@perl.org
On 9/3/07, Yitzchak Scott-Thoennes <stho...@efn.org> wrote:

> my $bytes_read = try_to_buffer_some_data() err die "read error: $!"

or a roll-your-own while-defined magic:
for(;;){
$nextline = <INPUTSTREAM> err last;
...

Ricardo SIGNES

unread,
Sep 3, 2007, 11:49:21 PM9/3/07
to perl5-...@perl.org
* Abigail <abi...@abigail.be> [2007-09-03T17:53:07]

> On Mon, Sep 03, 2007 at 01:23:53PM -0400, Ricardo SIGNES wrote:
> > 'err' is just about the worst name possible for low-precedence //. I guess
> > some sort of fifty-character string of gibberish mixing 1 and l would be
> > worse. err is pretty bad, though.
>
> Yes.
>
> But, frankly, p5p isn't the place to discuss it. The name 'err' comes
> from perl6. And AFAIK, it's pretty fixed there.

Of course it is. If that discussion comes down to, "Well, we're going to stick
with what Perl 6 did, for sanity's sake," then that's fine. It's still a
question about the language of perl 5.

--
rjbs

David Landgren

unread,
Sep 4, 2007, 4:53:40 AM9/4/07
to H.Merijn Brand, perl5-...@perl.org
H.Merijn Brand wrote:
> On Mon, 3 Sep 2007 13:23:53 -0400, Ricardo SIGNES
> <rjbs-p...@lists.manxome.org> wrote:
>
>> Porters,
>>
>> We're rapidly getting toward a real 5.10, when all the stuff that's been
>> getting worked on will be released to the world and more or less set in stone
>> for the next ten years. If there are lingering mistakes, we should really try
>> to fix them now, rather than 2017, by which time I assume we will all be
>> sipping pina coladas in a global socialist paradise.
>>
>> I was very happy to see the mistake of assertions fixed. I just have one more
>> Big Mistake that I'd like to see fixed before I can start working on perfecting
>> my pina colada mix.
>>
>> 'err' is just about the worst name possible for low-precedence //. I guess
>> some sort of fifty-character string of gibberish mixing 1 and l would be worse.
>> err is pretty bad, though.
>
> I don't really care either way, as long as I can have it available.
>
> The one thing that would pro for 'err' is that it is in my dor patch for
> 5.8.x since day one.

Heh. You said dor.

No-one has asked the obvious question: can we have both dor and err? I
can see that in certain contexts one makes more sense, and others, the
other.

David

Michael G Schwern

unread,
Sep 4, 2007, 7:47:04 PM9/4/07
to perl5-...@perl.org
Ricardo SIGNES wrote:
> Its meaning is entirely unclear to anyone who is not already inside the Perl
> Echo Chamber. When you're showing a non-Perl programmer some perl code that
> contains err, what will you say when he asks, "Why is that called err?" I
> guess you can say, "Because it sort of sounds like or. Get it?"

Let's leave aside the Perl 6 and Larry issue and compatibility with the 5.8
patches for the moment and move our brains about freely.

I prefer "dor". Why? The operator is described as a "low precedence
defined-or". "dor" at least communicates the important part ("or") while
remaining compact and a single syllable.

"err" is something you understand *AFTER* its already been explained to you.
Looking at it in code without already knowing the rationale for err people
will think its something to do with throwing an error. To put it in design
terms, without already knowing the design model, "err"'s interface (it's name)
conveys the wrong user model. It says "error" to the user.

This is borne out by how err() is already used in perl code today. Here's
Google Code Search finding all instances of "sub err ". You'll note most have
something to do with error handling.
http://www.google.com/codesearch?hl=en&lr=&q=lang%3Aperl+%22sub+err+%22&btnG=Search

This also brings up the point of "err" clashing with an existing user-defined
subroutine. I already hit this with Test::More. The Google Code Search above
shows there's plenty of code out there which already says "err". OTOH here's
the *two* instances of "sub dor " and one of them implements defined-or.
http://www.google.com/codesearch?hl=en&lr=&q=lang%3Aperl+%22sub+dor+%22&btnG=Search


--
Stabbing you in the face for your own good.

H.Merijn Brand

unread,
Sep 5, 2007, 2:05:23 AM9/5/07
to perl5-...@perl.org
On Tue, 04 Sep 2007 16:47:04 -0700, Michael G Schwern <sch...@pobox.com>
wrote:

> Ricardo SIGNES wrote:
> > Its meaning is entirely unclear to anyone who is not already inside the Perl
> > Echo Chamber. When you're showing a non-Perl programmer some perl code that
> > contains err, what will you say when he asks, "Why is that called err?" I
> > guess you can say, "Because it sort of sounds like or. Get it?"
>
> Let's leave aside the Perl 6 and Larry issue and compatibility with the 5.8
> patches for the moment and move our brains about freely.

Just for the sake of freedom, I'll go along :)

> I prefer "dor". Why? The operator is described as a "low precedence
> defined-or". "dor" at least communicates the important part ("or") while
> remaining compact and a single syllable.

I agree on this one. Fully. 100%

> "err" is something you understand *AFTER* its already been explained to you.
> Looking at it in code without already knowing the rationale for err people
> will think its something to do with throwing an error. To put it in design
> terms, without already knowing the design model, "err"'s interface (it's name)
> conveys the wrong user model. It says "error" to the user.

Yes, but it also says this for over two years now, and people might have
gotten used to it. Many language features, both programming and natural,
are not all obvious and need explaining, certainly if it is not ones own
natural language.

> This is borne out by how err() is already used in perl code today. Here's
> Google Code Search finding all instances of "sub err ". You'll note most have
> something to do with error handling.
> http://www.google.com/codesearch?hl=en&lr=&q=lang%3Aperl+%22sub+err+%22&btnG=Search

Note that this search also includes *old* fragments. Some of that code has
been changed in newer versions, even just because of the feature in pel-5.9.x
(I can refer to automake or autogen when I raised the issue eons ago, and they
changed the function names). Also DBI - which shows up in that search for
1.55 - has changed it.

> This also brings up the point of "err" clashing with an existing user-defined
> subroutine. I already hit this with Test::More. The Google Code Search above
> shows there's plenty of code out there which already says "err". OTOH here's
> the *two* instances of "sub dor " and one of them implements defined-or.
> http://www.google.com/codesearch?hl=en&lr=&q=lang%3Aperl+%22sub+dor+%22&btnG=Search

Just trying to clear all argument. As said before I can live with either.

Demerphq

unread,
Sep 5, 2007, 3:35:36 AM9/5/07
to Michael G Schwern, perl5-...@perl.org
On 9/5/07, Michael G Schwern <sch...@pobox.com> wrote:
> Ricardo SIGNES wrote:
> > Its meaning is entirely unclear to anyone who is not already inside the Perl
> > Echo Chamber. When you're showing a non-Perl programmer some perl code that
> > contains err, what will you say when he asks, "Why is that called err?" I
> > guess you can say, "Because it sort of sounds like or. Get it?"
>
> Let's leave aside the Perl 6 and Larry issue and compatibility with the 5.8
> patches for the moment and move our brains about freely.
>
> I prefer "dor". Why? The operator is described as a "low precedence
> defined-or". "dor" at least communicates the important part ("or") while
> remaining compact and a single syllable.

I get the impression that pretty much the *only* person who is in
favor of err is Larry.

I have yet to see or hear anybody say or write "wow, I really like
that 'err' keyword, its so well named for its purpose".

On the contrary, I've heard and seen *many* people say that they
consider it a petty bad decision.

Which either means err is an inspired decision and we just haven't
seen the light yet, or its a total blooper.

With all due respect to Larry I think its probably the latter.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

Michael G Schwern

unread,
Sep 5, 2007, 4:10:23 AM9/5/07
to H.Merijn Brand, perl5-...@perl.org
H.Merijn Brand wrote:
>> "err" is something you understand *AFTER* its already been explained to you.
>> Looking at it in code without already knowing the rationale for err people
>> will think its something to do with throwing an error. To put it in design
>> terms, without already knowing the design model, "err"'s interface (it's name)
>> conveys the wrong user model. It says "error" to the user.
>
> Yes, but it also says this for over two years now, and people might have
> gotten used to it. Many language features, both programming and natural,
> are not all obvious and need explaining, certainly if it is not ones own
> natural language.
>
>> This is borne out by how err() is already used in perl code today. Here's
>> Google Code Search finding all instances of "sub err ". You'll note most have
>> something to do with error handling.
>> http://www.google.com/codesearch?hl=en&lr=&q=lang%3Aperl+%22sub+err+%22&btnG=Search
>
> Note that this search also includes *old* fragments. Some of that code has
> been changed in newer versions, even just because of the feature in pel-5.9.x
> (I can refer to automake or autogen when I raised the issue eons ago, and they
> changed the function names). Also DBI - which shows up in that search for
> 1.55 - has changed it.

It's important to remember that we live in a very small echo chamber. Those
within the echo chamber have heard about dor and err for years now and have
begun to make changes accordingly.

Those outside the echo chamber have never heard of err or dor. They, and
their code, will be seeing it fresh and without any context. So consider the
old code being picked up there as a prediction of the future when 5.10 hits
the world outside.


--
Whip me, beat me, make my code compatible with VMS!

Michael G Schwern

unread,
Sep 5, 2007, 4:24:19 AM9/5/07
to Richar...@rfi.net, perl5-...@perl.org
Richard Foley wrote:

> On Wednesday 05 September 2007 01:47, Michael G Schwern wrote:
>> I prefer "dor". Why? The operator is described as a "low precedence
>> defined-or". "dor" at least communicates the important part ("or") while
>> remaining compact and a single syllable.
>>
>
> defor
>
> Or is that too much clarity (too long) for an operator, even these days?

I don't think that a user without prepping will guess what "defor" does any
better than "dor", so the extra letters would not be worth it. Once you know
it's "defined-or" then "dor" makes plenty of sense.

I suppose what's nice about "dor" is that unlike "err" it doesn't carry much
in the way of preconceptions of what its doing. So while we probably can't
give folks the right idea about what it does, at least we can avoid giving
them the wrong one.


--
Ahh email, my old friend. Do you know that revenge is a dish that is best
served cold? And it is very cold on the Internet!

Abigail

unread,
Sep 5, 2007, 4:35:51 AM9/5/07
to Michael G Schwern, perl5-...@perl.org


It won't clash.

use strict;
use warnings;
sub err {"Err\n"}
$_ = "Underscore\n";
print err "Blah";
__END__
Err

Only if you explicitely use "use feature 'err'", the 'err' will be treated
as an operator:

use strict;
use warnings;
use feature 'err';
sub err {"Err\n"}
$_ = "Underscore\n";
print err "Blah";
__END__
Useless use of a constant in void context at - line 5.
Underscore

Abigail

Richard Foley

unread,
Sep 5, 2007, 4:02:31 AM9/5/07
to perl5-...@perl.org, Michael G Schwern
On Wednesday 05 September 2007 01:47, Michael G Schwern wrote:
>
> I prefer "dor". Why? The operator is described as a "low precedence
> defined-or". "dor" at least communicates the important part ("or") while
> remaining compact and a single syllable.
>

defor

Or is that too much clarity (too long) for an operator, even these days?

--
Richard Foley
Ciao - shorter than aufwiedersehen

http://www.rfi.net/

Richard Foley

unread,
Sep 5, 2007, 4:44:39 AM9/5/07
to Michael G Schwern, perl5-...@perl.org
On Wednesday 05 September 2007 10:24, Michael G Schwern wrote:
>
> it's "defined-or" then "dor" makes plenty of sense.
>
> I suppose what's nice about "dor" is that unlike "err" it doesn't carry much
> in the way of preconceptions of what its doing. So while we probably can't
> give folks the right idea about what it does, at least we can avoid giving
> them the wrong one.
>
Yep, I have to agree that 'err' is a seriously misleading word for an
erstwhile 'or' operator.

Ben Morrow

unread,
Sep 5, 2007, 12:24:28 PM9/5/07
to perl5-...@perl.org

Quoth deme...@gmail.com (demerphq):

> On 9/5/07, Michael G Schwern <sch...@pobox.com> wrote:
> > Ricardo SIGNES wrote:
> > > Its meaning is entirely unclear to anyone who is not already inside the Perl
> > > Echo Chamber. When you're showing a non-Perl programmer some perl code that
> > > contains err, what will you say when he asks, "Why is that called err?" I
> > > guess you can say, "Because it sort of sounds like or. Get it?"
> >
> > Let's leave aside the Perl 6 and Larry issue and compatibility with the 5.8
> > patches for the moment and move our brains about freely.
> >
> > I prefer "dor". Why? The operator is described as a "low precedence
> > defined-or". "dor" at least communicates the important part ("or") while
> > remaining compact and a single syllable.
>
> I get the impression that pretty much the *only* person who is in
> favor of err is Larry.
>
> I have yet to see or hear anybody say or write "wow, I really like
> that 'err' keyword, its so well named for its purpose".

My impression is that 'err' makes a lot of sense *in the context of Perl
6*. Perl 6 has (or can have... I've lost track :) ) a lot of functions
which return what Larry calls 'special values of undef': unthrown
exception objects which appear to be undefined until you throw them. In
this context, and remembering that and/or/err are flow-control
operators, not boolean operators, most uses of err in Perl 6 probably
*will* be for error handling, along the lines of 'open or die'.

I can't see using 'err' much at all in Perl 5, myself. // and //=, yes,
I will be really glad to have those. But flow-control based on
definedness rather than truth, especially given '0 but true'?

Ben

Rick Delaney

unread,
Sep 5, 2007, 2:31:38 PM9/5/07
to demerphq, Michael G Schwern, perl5-...@perl.org
On Sep 05 2007, demerphq wrote:
> I get the impression that pretty much the *only* person who is in
> favor of err is Larry.
>
> I have yet to see or hear anybody say or write "wow, I really like
> that 'err' keyword, its so well named for its purpose".

Well, of course, since people don't talk like that. ;-) However,
Yitzchak came down in favour of "err", and FWIW I agree 100% with his
explanation of why.

--
Rick Delaney
ri...@bort.ca

Yitzchak Scott-Thoennes

unread,
Sep 5, 2007, 3:28:03 PM9/5/07
to Ben Morrow, perl5-...@perl.org
On Wed, September 5, 2007 9:24 am, Ben Morrow wrote:
> Quoth deme...@gmail.com (demerphq):

>> I get the impression that pretty much the *only* person who is in
>> favor of err is Larry.
>>
>> I have yet to see or hear anybody say or write "wow, I really like
>> that 'err' keyword, its so well named for its purpose".

Wow, I really like that 'err' keyword, it's so well named for (one of) its
purpose(s).

> My impression is that 'err' makes a lot of sense *in the context of Perl
> 6*. Perl 6 has (or can have... I've lost track :) ) a lot of functions
> which return what Larry calls 'special values of undef': unthrown exception
> objects which appear to be undefined until you throw them. In this
> context, and remembering that and/or/err are flow-control operators, not
> boolean operators, most uses of err in Perl 6 probably *will* be for error
> handling, along the lines of 'open or die'.
>
> I can't see using 'err' much at all in Perl 5, myself. // and //=, yes,
> I will be really glad to have those. But flow-control based on
> definedness rather than truth, especially given '0 but true'?

That makes sense wrt builtins and current CPAN modules that are designed
to work with "or" flow-control and so use the "0 but true" or "0E0" hacks.

But not all code is in the core or on CPAN. Having err makes it easier
to write subs that return undef for error but sometimes 0 on success,
without reaching for the hacks.

Ricardo SIGNES

unread,
Sep 5, 2007, 4:37:38 PM9/5/07
to perl5-...@perl.org
* Ben Morrow <b...@morrow.me.uk> [2007-09-05T12:24:28]

> I can't see using 'err' much at all in Perl 5, myself. // and //=, yes,
> I will be really glad to have those. But flow-control based on
> definedness rather than truth, especially given '0 but true'?

I think flow control based on definedness is quite useful.

Exception::WTF->throw( ... ) unless defined (my $x = $arg->{numeric});

Forcing people to pass in 0e0 is impolite and mind-bending. If you are not
deeply steeped in Perl Weirdness, you will just think that the author who is
saying, "0 will fail but 0e0 works" is a weird jerk.

So, one of:

unless (defined (my $x = $arg->{numeric})) { Exception::WTF->throw( ... ) }

Exception::WTF->throw( ... ) unless defined (my $x = $arg->{numeric});

my $x = $arg->{numeric} err Exception::WTF->throw( ... );

Strangely enough, I'd use the first, but the third is pretty reasonble, and
illustrates why YST likes "err".

I still don't like err. When it's not used like this, it won't make sense.
Even when used here, what makes the thing on the left an error? In this case,
it may be guessable. In others, I think it will be less so.

--
rjbs

Marvin Humphrey

unread,
Sep 5, 2007, 5:05:22 PM9/5/07
to Ricardo SIGNES, perl5-...@perl.org

On Sep 5, 2007, at 1:37 PM, Ricardo SIGNES wrote:

> my $x = $arg->{numeric} err Exception::WTF->throw( ... );
>
> Strangely enough, I'd use the first, but the third is pretty
> reasonble, and
> illustrates why YST likes "err".

This seems considerably clearer to me at least:

my $x = $arg->{numeric} dor Exception::WTF->throw( ... );

The name "err" is not needed to identify the right hand side as an
error routine.

Furthermore, dor clearly indicates what logic is being executed --
making it easy to see under what circumstances the error routine will
be triggered.

The fact that "err" is a verb in English implies action. It looks
like a subroutine.

$args->{required_param} dor err("You forgot required_param!");

So, IMO, dor is better even where err is at its best.

Chromatic

unread,
Sep 5, 2007, 6:22:17 PM9/5/07
to perl5-...@perl.org, Michael G Schwern
On Tuesday 04 September 2007 16:47:04 Michael G Schwern wrote:

> "err" is something you understand *AFTER* its already been explained to
> you.

Bad metric.

I've written a lot of code in a lot of languages and in so doing have found
very few things that were immediately, intuitively, and completely obvious.

-- c

Michael G Schwern

unread,
Sep 5, 2007, 8:37:48 PM9/5/07
to chromatic, perl5-...@perl.org

"Everyone else does it wrong" is a poor argument.

A. Pagaltzis

unread,
Sep 6, 2007, 12:20:28 PM9/6/07
to perl5-...@perl.org
* Michael G Schwern <sch...@pobox.com> [2007-09-05 01:50]:

> I prefer "dor". Why? The operator is described as a "low
> precedence defined-or". "dor" at least communicates the
> important part ("or") while remaining compact and a single
> syllable.
>
> "err" is something you understand *AFTER* its already been
> explained to you.

Yeah, `err` implies the wrong thing before you know what it’s
for. But `dor` implies nothing. If I didn’t know what it is, I
wouldn’t have any idea what `$foo dor $bar` means – and I would
certainly not guess it is very similar to `or`. If you wanted to
make the name even remotely suggestive, you’d have to use
something like `def_or`.

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>

A. Pagaltzis

unread,
Sep 6, 2007, 12:22:34 PM9/6/07
to perl5-...@perl.org
* Michael G Schwern <sch...@pobox.com> [2007-09-05 10:25]:

> Once you know it's "defined-or" then "dor" makes plenty of
> sense.

I thought the point was that you wanted to avoid the “once you
know” bit.

_Once you know_, `err` makes about as much sense.

A. Pagaltzis

unread,
Sep 6, 2007, 12:37:53 PM9/6/07
to perl5-...@perl.org
* Ricardo SIGNES <rjbs-p...@lists.manxome.org> [2007-09-03 19:25]:

> 'err' is just about the worst name possible for low-precedence
> //. […] (I really do like 'dor', though.)

I think they are both about equally terrible for different
reasons.

I haven’t seen a good name for this thing so far.

The shortest good name I can think of, as I wrote in another
reply, is `def_or`. But I guess that’s out because Perl doesn’t
do underscores in parts of the core language. (And it really
needs the underscore because `defor` decomposes more readily as
“de-for” than “def-or”.)

Without underscores I can’t think of anything better than
`definedor`, which is too long even for me. (I rarely mind a
touch of verbosity when it serves the right purpose.)

Marvin Humphrey

unread,
Sep 6, 2007, 1:06:45 PM9/6/07
to A. Pagaltzis, perl5-...@perl.org

On Sep 6, 2007, at 9:37 AM, A. Pagaltzis wrote:

> I think they are both about equally terrible for different
> reasons.

Actively misleading is worse than opaque.

'dor' isn't even completely opaque. It looks like 'or' and 'xor'.

Rafael Garcia-Suarez

unread,
Sep 6, 2007, 1:10:49 PM9/6/07
to perl5-...@perl.org
Larry decided to rename err to orelse in Perl 6. (with a few changes,
irrelevant to Perl 5, see the perl6-language mailing list.) Also, a
new operator andthen has been added. See synopsis 3.

That makes err obsolete. So, I'll remove it from Perl 5.10.

orelse and andthen can wait a further release to be added (as a
feature in the sense of feature.pm) to Perl 5.

Tels

unread,
Sep 6, 2007, 1:20:37 PM9/6/07
to perl5-...@perl.org, Marvin Humphrey, A. Pagaltzis
Moin,

On Thursday 06 September 2007 19:06:45 Marvin Humphrey wrote:
> On Sep 6, 2007, at 9:37 AM, A. Pagaltzis wrote:
> > I think they are both about equally terrible for different
> > reasons.
>
> Actively misleading is worse than opaque.
>
> 'dor' isn't even completely opaque. It looks like 'or' and 'xor'.

I like "dor" because the "or" bit will remind me on its purpose and meaning
even after I forgot how the operator was named.

And "err" always makes me think of errors, but

my $a = $params->{a} dor "default";

is not about error handling but about setting default values.

But I guess:

my $color = $params->{color} default "white";

will not be usefull :)

All the best,

Tels


--
Signed on Thu Sep 6 19:18:11 2007 with key 0x93B84C15.
View my photo gallery: http://bloodgate.com/photos
PGP key on http://bloodgate.com/tels.asc or per email.

"Now, _you_ behave!"

Tels

unread,
Sep 6, 2007, 1:21:54 PM9/6/07
to perl5-...@perl.org, Rafael Garcia-Suarez
Moin,

So you also removed "dor"? :-(

Damn, there goes one of the most usefull features of Perl. :-(

Tels

--
Signed on Thu Sep 6 19:21:19 2007 with key 0x93B84C15.


View my photo gallery: http://bloodgate.com/photos
PGP key on http://bloodgate.com/tels.asc or per email.

"In computer science, we stand on each other's feet."

-- Brian K. Reid

Rafael Garcia-Suarez

unread,
Sep 6, 2007, 1:23:27 PM9/6/07
to Tels, perl5-...@perl.org
On 06/09/07, Tels <nospam...@bloodgate.com> wrote:
> > That makes err obsolete. So, I'll remove it from Perl 5.10.
> >
> > orelse and andthen can wait a further release to be added (as a
> > feature in the sense of feature.pm) to Perl 5.
>
> So you also removed "dor"? :-(

There was never any operator named dor in the Perl 5 trunk.... If you
speak about // and //=, of course not, they are here to stay!

Demerphq

unread,
Sep 6, 2007, 1:30:53 PM9/6/07
to Rafael Garcia-Suarez, perl5-...@perl.org

But... If 'err' is gone, then please can we have dor? Or 'orelse' ?

Or should i not ask?

Tels

unread,
Sep 6, 2007, 1:47:31 PM9/6/07
to perl5-...@perl.org, Rafael Garcia-Suarez
Moin,

Ah good.

But now I am a bit confused, when we have "//" and "//=", why do we had err?

If "err" is to "//" what "or" is to "||", why wasn't it named "dor" in the
first place (Consistency! Consistency! Consistency!)?

Plus, all that talk about err and dor really had me believe we had a "dor"
operator. So confusing.

All the best,

Tels

--
Signed on Thu Sep 6 19:45:33 2007 with key 0x93B84C15.


View my photo gallery: http://bloodgate.com/photos
PGP key on http://bloodgate.com/tels.asc or per email.

"COMPASS [for the CDC-6000 series] is the sort of assembler one expects
from a corporation whose president codes in octal."

-- J.N. Gray

Demerphq

unread,
Sep 6, 2007, 2:06:40 PM9/6/07
to Marvin Humphrey, A. Pagaltzis, perl5-...@perl.org
On 9/6/07, Marvin Humphrey <mar...@rectangular.com> wrote:
>
> On Sep 6, 2007, at 9:37 AM, A. Pagaltzis wrote:
>
> > I think they are both about equally terrible for different
> > reasons.
>
> Actively misleading is worse than opaque.
>
> 'dor' isn't even completely opaque. It looks like 'or' and 'xor'.

I agree with both points. 'err' is bad because its misleading, 'dor'
is good because it doesnt have existing semantics, and it looks like
the things which have similar/related semantics. And its nicely
huffman coded in terms of length unlike 'defined_or'. (I bet dor is
used more often than xor in perl so i dont think it should be longer)
.

Although, its maybe worth noting that 'or' and 'xor' are actually more
different than 'or' and 'dor', as 'or' and 'dor' are short-circuiting
wheras 'xor' is not. Which to me is a point in 'dor's favor.

cheers,

Larry Wall

unread,
Sep 6, 2007, 2:19:20 PM9/6/07
to Tels, perl5-...@perl.org, Marvin Humphrey, A. Pagaltzis
On Thu, Sep 06, 2007 at 07:20:37PM +0200, Tels wrote:
: And "err" always makes me think of errors, but

:
: my $a = $params->{a} dor "default";
:
: is not about error handling but about setting default values.

Actually, it's about a precedence error. Which is why I think //
should be pronounced "defaults to", and any low precedence equivalent
should not, in fact, be equivalent. (Perl 6's new "andthen" and "orelse"
are specifically aimed at logic programming, not default setting.)

: But I guess:


:
: my $color = $params->{color} default "white";
:
: will not be usefull :)

Not unless it has the precedence of //, which already happens to have
that precedence, oddly enough. :)

Larry

Tels

unread,
Sep 6, 2007, 2:39:01 PM9/6/07
to Larry Wall, perl5-...@perl.org, Marvin Humphrey, A. Pagaltzis
Moin,

So a "low-precedence equivalent" wouldn't be very usefull, anyway? And if I
understand right:

my $color = $params->{color} // "white";

will be the idiom I would be using (which is even shorter :-).

All the best,

Tels

--
Signed on Thu Sep 6 20:36:06 2007 with key 0x93B84C15.


View my photo gallery: http://bloodgate.com/photos
PGP key on http://bloodgate.com/tels.asc or per email.

This email violates EU patent EP0394160:

[ ########## 66% ####
]

A. Pagaltzis

unread,
Sep 6, 2007, 3:02:26 PM9/6/07
to perl5-...@perl.org
* Tels <nospam...@bloodgate.com> [2007-09-06 20:10]:

> And "err" always makes me think of errors, but
>
> my $a = $params->{a} dor "default";
>
> is not about error handling but about setting default values.

That’s why you spell it `//`:

my $a = $params->{a} // "default";

The low-precedence `dor`/`err` version is for control flow. Think
of this:

open my $fh, '<', $file
or die $!;

Consider `||` vs `or`.

A. Pagaltzis

unread,
Sep 6, 2007, 3:22:19 PM9/6/07
to perl5-...@perl.org
* Larry Wall <la...@wall.org> [2007-09-06 20:25]:

> (Perl 6's new "andthen" and "orelse" are specifically aimed at
> logic programming, not default setting.)

I think `orelse` would be a great name for this operator. Would
making it the name for low-precedence `//` in Perl 5 be a
problem? Because personally I’d vote strongly in favour of that.

A. Pagaltzis

unread,
Sep 6, 2007, 3:20:02 PM9/6/07
to perl5-...@perl.org
* demerphq <deme...@gmail.com> [2007-09-06 20:10]:

> 'err' is bad because its misleading,

Sure.

> 'dor' is good because it doesnt have existing semantics, and it
> looks like the things which have similar/related semantics.

Not to me it doesn’t. To me `dor` looks neither like an operator
in the first place, nor similar to `or`, much less `xor`. Unlike
`xor` it looks pronouncable, like you were supposed to say it out
loud sorta like “durr”.

On these points, `err` comes away a bit better, though not
terribly well either.

> And its nicely huffman coded in terms of length unlike
> 'defined_or'. (I bet dor is used more often than xor in perl so
> i dont think it should be longer)

The problem with Huffman coding is that it can only work
reasonably once, up front. If you wanted to bring it up in this
context I would say the conclusion one would have to draw is that
`xor` should have been longer, not that `dor` should be as short
as `xor`.

A. Pagaltzis

unread,
Sep 6, 2007, 3:27:52 PM9/6/07
to perl5-...@perl.org
* Rafael Garcia-Suarez <rgarci...@gmail.com> [2007-09-06 20:10]:

> orelse and andthen can wait a further release to be added (as a
> feature in the sense of feature.pm) to Perl 5.

So it will be in 5.10.1 as `orelse`? (I would *LOVE* to have it
in the language as `orelse`.) Or do you mean the 5.12 timeframe?

Alan Olsen

unread,
Sep 6, 2007, 4:43:57 PM9/6/07
to Tels, perl5-...@perl.org, Rafael Garcia-Suarez
On Thu, 2007-09-06 at 19:21 +0200, Tels wrote:
> Moin,
>
> On Thursday 06 September 2007 19:10:49 Rafael Garcia-Suarez wrote:
> > Larry decided to rename err to orelse in Perl 6. (with a few changes,
> > irrelevant to Perl 5, see the perl6-language mailing list.) Also, a
> > new operator andthen has been added. See synopsis 3.
> >
> > That makes err obsolete. So, I'll remove it from Perl 5.10.
> >
> > orelse and andthen can wait a further release to be added (as a
> > feature in the sense of feature.pm) to Perl 5.
>
> So you also removed "dor"? :-(
>
> Damn, there goes one of the most usefull features of Perl. :-(

Maybe "err" should be renamed "doh".

al...@alfarrabio.di.uminho.pt

unread,
Sep 6, 2007, 4:47:06 PM9/6/07
to Alan Olsen, Tels, perl5-...@perl.org, Rafael Garcia-Suarez
dor is gone?

And // ?

--
Alberto Simões - Departamento de Informática - Universidade do Minho
Campus de Gualtar - 4710-057 Braga - Portugal

H.Merijn Brand

unread,
Sep 6, 2007, 5:02:24 PM9/6/07
to perl5-...@perl.org, al...@bombordo.di.uminho.pt
On Thu, 06 Sep 2007 21:47:06 +0100, Alberto Simões
<al...@bombordo.di.uminho.pt> wrote:

> dor is gone?

no. 'err' has gone. 'dor' never has been.
can we pay for err to stay? even if it were called dor?
maybe I should continue to maintain my dor patch for 5.10.x
actually putting dor back in ...

> And // ?

still there to stay :)
and //= also

> Alan Olsen wrote:
> > On Thu, 2007-09-06 at 19:21 +0200, Tels wrote:
> >> Moin,
> >>
> >> On Thursday 06 September 2007 19:10:49 Rafael Garcia-Suarez wrote:
> >>> Larry decided to rename err to orelse in Perl 6. (with a few changes,
> >>> irrelevant to Perl 5, see the perl6-language mailing list.) Also, a
> >>> new operator andthen has been added. See synopsis 3.
> >>>
> >>> That makes err obsolete. So, I'll remove it from Perl 5.10.
> >>>
> >>> orelse and andthen can wait a further release to be added (as a
> >>> feature in the sense of feature.pm) to Perl 5.
> >> So you also removed "dor"? :-(
> >>
> >> Damn, there goes one of the most usefull features of Perl. :-(
> >
> > Maybe "err" should be renamed "doh".
>


--
H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.9.x on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.0 & 10.2, AIX 4.3 & 5.2, and Cygwin. http://qa.perl.org
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org
http://www.goldmark.org/jeff/stupid-disclaimers/

al...@alfarrabio.di.uminho.pt

unread,
Sep 6, 2007, 5:05:58 PM9/6/07
to H.Merijn Brand, perl5-...@perl.org, al...@bombordo.di.uminho.pt
H.Merijn Brand wrote:
> On Thu, 06 Sep 2007 21:47:06 +0100, Alberto Simões
> <al...@bombordo.di.uminho.pt> wrote:
>
>> dor is gone?
>
> no. 'err' has gone. 'dor' never has been.
> can we pay for err to stay? even if it were called dor?
> maybe I should continue to maintain my dor patch for 5.10.x
> actually putting dor back in ...

Damn,
YAPC::EU auction was last week. We could ask for people to pay for err.

Alan Olsen

unread,
Sep 6, 2007, 5:09:25 PM9/6/07
to al...@alfarrabio.di.uminho.pt, H.Merijn Brand, perl5-...@perl.org, al...@bombordo.di.uminho.pt
On Thu, 2007-09-06 at 22:05 +0100, Alberto Simões wrote:
> H.Merijn Brand wrote:
> > On Thu, 06 Sep 2007 21:47:06 +0100, Alberto Simões
> > <al...@bombordo.di.uminho.pt> wrote:
> >
> >> dor is gone?
> >
> > no. 'err' has gone. 'dor' never has been.
> > can we pay for err to stay? even if it were called dor?
> > maybe I should continue to maintain my dor patch for 5.10.x
> > actually putting dor back in ...
>
> Damn,
> YAPC::EU auction was last week. We could ask for people to pay for err.

I think paying for err is called "Vista".

David Landgren

unread,
Sep 6, 2007, 5:33:35 PM9/6/07
to perl5-...@perl.org
A. Pagaltzis wrote:
> * demerphq <deme...@gmail.com> [2007-09-06 20:10]:

>> And its nicely huffman coded in terms of length unlike


>> 'defined_or'. (I bet dor is used more often than xor in perl so
>> i dont think it should be longer)
>
> The problem with Huffman coding is that it can only work
> reasonably once, up front. If you wanted to bring it up in this
> context I would say the conclusion one would have to draw is that
> `xor` should have been longer, not that `dor` should be as short
> as `xor`.

Well if one considers that // is likely to be heavily used, and
err/dor/orelse, rarely, then I think 'otherwise' would be even better.

David

Demerphq

unread,
Sep 6, 2007, 5:34:42 PM9/6/07
to al...@alfarrabio.di.uminho.pt, H.Merijn Brand, perl5-...@perl.org, al...@bombordo.di.uminho.pt
On 9/6/07, Alberto Simões <al...@alfarrabio.di.uminho.pt> wrote:
> H.Merijn Brand wrote:
> > On Thu, 06 Sep 2007 21:47:06 +0100, Alberto Simões
> > <al...@bombordo.di.uminho.pt> wrote:
> >
> >> dor is gone?
> >
> > no. 'err' has gone. 'dor' never has been.
> > can we pay for err to stay? even if it were called dor?
> > maybe I should continue to maintain my dor patch for 5.10.x
> > actually putting dor back in ...
>
> Damn,
> YAPC::EU auction was last week. We could ask for people to pay for err.

Id bid for 'dor'. Seriously.

Abigail

unread,
Sep 6, 2007, 5:50:45 PM9/6/07
to David Landgren, perl5-...@perl.org


I disagree. 'otherwise' and 'orelse' have one big disadvantage. They
are synonymes for 'or' - nothing in their names suggests they act on
definedness, not just truth value.

I would find it quite confusing if neither of

0 otherwise print "foo";
0 orelse print "bar";

prints anything. After all

0 or print "baz";

*does* print something.


'err' as a binary operator doesn't suggest anything. IMO, that's far
superiour over suggesting the wrong thing.

I'd rather have a name like "Poo_tee_weet" instead of "otherwise" or
"orelse".

My current preferences are:

1) Name the operator 'dor'.
2) Name the operator 'err'.
3) Don't have a low level // equivalent.
100) Name the operator 'orelse'.


Abigail

Marvin Humphrey

unread,
Sep 6, 2007, 5:55:08 PM9/6/07
to David Landgren, perl5-...@perl.org

On Sep 6, 2007, at 2:33 PM, David Landgren wrote:

> Well if one considers that // is likely to be heavily used, and err/
> dor/orelse, rarely, then I think 'otherwise' would be even better.

'orelse' appeals to my violent side, which is always a bonus. }:-)

Unfortunately, it's misleading, too -- because it looks like 'or
else'. It looks like it tests truth -- not defined-ness.

The same flaw afflicts 'otherwise'.

'dor' looks like shorthand for exactly what it is: defined or. It's
actually parallel to 'xor', in that it transforms "or" with a single
letter standing in for an adjective.

defined or => dor
exclusive or => xor

What's wrong with 'dor'?

Jim Cromie

unread,
Sep 6, 2007, 6:07:26 PM9/6/07
to Marvin Humphrey, David Landgren, perl5-...@perl.org

If Jackson Pollack had a bikeshed .... :-D

H.Merijn Brand

unread,
Sep 7, 2007, 2:07:11 AM9/7/07
to perl5-...@perl.org

/me too

Have a poll on PM?
/me ducks

Tels

unread,
Sep 7, 2007, 9:54:40 AM9/7/07
to perl5-...@perl.org, Marvin Humphrey, David Landgren
Moin,

That is exactly my opinion :)

All the best,

Tels

--
Signed on Fri Sep 7 15:54:18 2007 with key 0x93B84C15.


View my photo gallery: http://bloodgate.com/photos
PGP key on http://bloodgate.com/tels.asc or per email.

"Call me Justin, Justin Case."

Reini Urban

unread,
Sep 8, 2007, 12:43:45 AM9/8/07
to perl5-...@perl.org
H.Merijn Brand schrieb:

> On Thu, 6 Sep 2007 23:34:42 +0200, demerphq <deme...@gmail.com> wrote:
>
>> On 9/6/07, Alberto Simões <al...@alfarrabio.di.uminho.pt> wrote:
>>> H.Merijn Brand wrote:
>>>> On Thu, 06 Sep 2007 21:47:06 +0100, Alberto Simões
>>>> <al...@bombordo.di.uminho.pt> wrote:
>>>>
>>>>> dor is gone?
>>>> no. 'err' has gone. 'dor' never has been.
>>>> can we pay for err to stay? even if it were called dor?
>>>> maybe I should continue to maintain my dor patch for 5.10.x
>>>> actually putting dor back in ...
>>> Damn,
>>> YAPC::EU auction was last week. We could ask for people to pay for err.
>> Id bid for 'dor'. Seriously.
>
> /me too
>
> Have a poll on PM?
> /me ducks

/me thinks that Rafael did the best here.

I rather want to have less magic operators in CORE which are not
backwards compatible. So writing that "defined ... or" out explicitly
is for me having to maintain code which should run on 5.8 also by far
superior than the handy new shortcut, which is valid for one release
cycle only.
--
Reini Urban
http://phpwiki.org/ http://murbreak.at/
http://helsinki.at/ http://spacemovie.mur.at/

0 new messages