develooper Front page | perl.perl5.porters | Postings from June 2022

Re: Pre-RFC: A built-in ability for lexical import/export

Thread Previous | Thread Next
From:
Ovid
Date:
June 27, 2022 17:11
Subject:
Re: Pre-RFC: A built-in ability for lexical import/export
Message ID:
CA+M4CHvyxXLjg-BmOF3mA4X5nR3TkGL4-ZfwBP5h7WrT-=oj=A@mail.gmail.com
On Mon, Jun 27, 2022 at 5:30 PM Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
wrote:

> >   * Should it support things other than functions? Should we support
> >
> >       lexically_export VAR => \my $scalar;
>
> And this.
>

I'm concerned about this. Lexical import is designed to limit things to the
current scope and not expose them to the outside world. Because you're
exporting a reference, it's effectively a global variable. If more than one
bit of code imports that reference and alters it, other bits of code might
have already taken decisions based on that data, but the assumptions it
relied on are no longer true.

I've just spent several days chasing down a bug that's caused by this and
I've had to do so multiple times for my current client. My client is losing
money paying me to fix design flaws rather than build the new features they
want. I'd rather not add another feature to Perl which encourages this
practice.

Curtis "Ovid" Poe
CTO, All Around the World
World-class software development and consulting
https://allaroundtheworld.fr/

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