develooper Front page | perl.perl5.porters | Postings from March 2016

Re: Putting Winsock errors into $^E

Thread Previous | Thread Next
Aristotle Pagaltzis
March 17, 2016 02:17
Re: Putting Winsock errors into $^E
Message ID:
* Laurent <> [2016-03-17 00:00]:
> I disagree with your argument that because the code "works" (to some
> extend) then it is not broken. Perl, for instance, has been broken for
> this reason for years (assigning WSA* codes to E* constants), but
> "worked fine"... until the namespace clash happened. And your solution
> is still broken as it puts a WSA error into $! with a POSIX code.

The code has always been broken because Perl forced it to be broken. But
it worked as well as circumstances allowed. To suddenly now make it stop
working at all and force it to be updated to be correct to work again is
abusive. Perl forced the code to be broken so it has the responsibility
in this relationship to make the broken code work as well as it can, and
to offer the *option* for new or updated code to be correct, and then to
wait for old code to catch up.

> There are also example of code "working fine", eg: assuming that keys
> of hashes were always sorted in the same order, that got "fixed"
> anyway (no intent to debate more on this).

That one is a much more complicated issue. (Unfortunately.)

> I believe that people will continue to confuse WSAE* and E*:
> - as Perl let them do this (as Perl actually does it itself in $!)
> - as Perl doc often does not define error codes, leaving users check
>   the system man pages instead (and by habit... one could directly go
>   to man pages in such cases).
> - because when porting Perl code to Windows, one can easily overlook
>   the problem as the broken $! comparison will possibly hide the issue.
> - as there will be many examples of broken code in the wild (including
>   in CPAN, given that modules have no strong reasons to fix their code).

That is all true. And for the time being, it is by design. At the same
time, it is not how things are supposed to be. In the future, this needs
to be fixed. We will have to figure out how to do that *without* simply
making everyone’s code suddenly stop (sort of) working.

Eventually, someday, such code *will* stop working – but not until there
has been *ample* notice (and opportunity!) to fix it.

Adding a way for such code to be made correct, now, optionally, is the
first step on that road. Not the last. Far from it.

Aristotle Pagaltzis // <>

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About