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

Re: Pre-RFC: a `module` keyword

Thread Previous | Thread Next
Paul "LeoNerd" Evans
January 24, 2022 19:26
Re: Pre-RFC: a `module` keyword
Message ID:
On Mon, 24 Jan 2022 19:20:41 +0000 (UTC)
Ovid via perl5-porters <> wrote:

> I've been thinking about this a lot and I wanted to run an idea past
> P5P. Corinna tremendously cleans up Perl's OOP capabilities. It would
> be nice to have something like that for procedural code. I have no
> sponsor for this, but I was thinking about a `module` keyword.

Yeah we discussed that back in Amsterdam 2019. It seemed a reasonable
idea then.

I had a go at implementing it:

It's a little out-of-date at the moment but I suspect it can be updated
quite easily

> Benefits:
> * Postfix block lexically scopes changes
> * Strict, warnings, utf8 source, signatures, and "no feature
> 'indirect'" by default

already done

> * :export is handled natively leaving the import() free for other uses
> * Yields a `1` to avoid needing to add `1` at the end of every file.

both seem good ideas.

I especially like the `:export` attribute - that's always struck me as
a much nicer way to do things than the current OHMYGODTHEHACK that is

As a Pre-RFC I like this idea. If nobody else has any huge "absolutely
no because ${^SOLID_REASON}" I suggest writing it up as a full RFC.

Paul "LeoNerd" Evans      |  |

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