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

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

Thread Previous | Thread Next
Darren Duncan
August 7, 2021 12:16
Re: "use v5.36.0" should imply ASCII source
Message ID:
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

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