develooper Front page | perl.perl5.porters | Postings from August 2021

Re: "use v5.36.0" should imply ASCII source

Thread Previous | Thread Next
From:
Martijn Lievaart
Date:
August 8, 2021 12:53
Subject:
Re: "use v5.36.0" should imply ASCII source
Message ID:
5a3812ea-1cbf-2b0d-cddc-5afb05e1a23c@rtij.nl
Op 07-08-2021 om 14:15 schreef Darren Duncan:
> On 2021-08-07 5:01 a.m., Martijn Lievaart wrote:
>> Op 07-08-2021 om 08:51 schreef Darren Duncan:
>>> Or even putting aside the POD, is there any real scenario where a 
>>> single file consisting of only Perl code is in multiple encodings at 
>>> once?
>>
>> Probably not, but ...
>>
>>> If there is a "use utf8;" anywhere in a Perl file, would it not be 
>>> reasonable to interpret that it is describing the entire file and 
>>> not just the portion of the file below that statement?
>>
>> ... I don't feel that is reasonable. It's not how "use" works in 
>> general. "Use" affects the file being parsed from that point on. If 
>> you want it to affect the whole file, put it as the first statement.
>>
>> But I don't get what you want to achieve, what problem you want to 
>> solve with this solution?
>
> I propose that if we don't want to explicitly support mixed encodings 
> then explicit encoding declarations are a special case (that can be 
> clearly documented) where their effect should be retroactive to 
> describe the whole file, because logically that's the only thing that 
> makes sense (for a non mixed encoding file, declaring any part of it 
> as UTF-8 is logically saying the whole file is UTF-8), even if it does 
> happen to have the form of a "use" statement. -- Darren Duncan


Well, there actually is one mixed encoding that makes sense, ASCII up 
until the 'use utf8', Unicode after that. I would assume this is the 
mental model most people have.


M4



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