develooper Front page | perl.perl5.porters | Postings from December 2008

Re: RFC: Consolidated proposal for octals like \400 in strings. Was:PATCH [perl #59342] chr(0400)

Thread Previous | Thread Next
From:
Ben Morrow
Date:
December 5, 2008 17:02
Subject:
Re: RFC: Consolidated proposal for octals like \400 in strings. Was:PATCH [perl #59342] chr(0400)
Message ID:
u5vo06-mld.ln1@osiris.mauzo.dyndns.org

Quoth public@khwilliamson.com (karl williamson):
> I've done some more research and thought about this, and have come up 
> with the enclosed straw proposa1.  I hope I haven't shortchanged 
> anyone's previous ideas.
> 
> I now know enough about perl internals that I could implement all of 
> this as-is (or with modifications) in short order.
> 
> 1.  There shall be a new pragma "legacy"
> 
> Things like "use legacy 'octals'" can be used for various behaviors we 
> change but that we want to allow the old way of doing things to still be 
> possible.  The list of legacy operations can be expanded in the future 
> as necessary.

I'm afraid I'm deeply suspicious of this. What's wrong with using

    use feature 'sane-octals';

or some such instead, just for the sake of not breaking things if we
don't have to?

More fully: 

If the old behaviour (I'm not talking specifically about ocal escapes
here, but about any potential 'legacy' pragma) is always wrong, then
it's a bug and should simply be fixed. There is no need to keep the old
behaviour at all. 

If the old behaviour is potentially used somewhere but considered
confusing or broken, it seems more reasonable to make people wanting the
new behaviour ask for it than to make people update old scripts they
haven't changed since perl-5.XXX. These people would need to

    - find their scripts no longer work with 5.12, 
   (- care enough not to simply say '5.12 is broken' and reinstall 5.8.9,)
    - read the changelog and realise they need the 'legacy' pragma,
    - go through and insert 'use legacy' lines where necessary, and 
    - install legacy.pm from CPAN on all pre-5.12 installations of perl.
    
I presume you were thinking legacy.pm would be dual-lifed? These old
perl installations would also need their legacy.pms kept up to date, as
new legacy options were defined and added to existing scripts. This is
the sort of thing that is likely to be a problem on installations stuck
with an old version of perl for policy reasons. (I suppose we could
potentially make lagacy.pm accept any arguments without fuss, and put a
version on CPAN (with a lower version number than that in any perl
distribution) that simply accepts any arguments and does nothing.)

If these changes were made 'feature's instead, all people wanting new
behaviour would have to do is insert

    use 5.012;

at the top of their programs (or use -E), something they are likely to
be doing anyway to get other features they are interested in; *unless*
they are specifically trying to write code which is compatible with
older perls, in which case they would want all the legacy options 'on'
anyway.

(I have no comment on the specifics of the octal syntax change, except
that I *really* doubt anyone will ever use octal other than as \XXX for
a single byte, and I strongly suspect that if \XXX stops working
everyone will simply switch to \xYY instead.)

Ben


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