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

Re: Pre-RFC: a `module` keyword

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
January 24, 2022 19:26
Subject:
Re: Pre-RFC: a `module` keyword
Message ID:
20220124192606.19581f81@shy.leonerd.org.uk
On Mon, 24 Jan 2022 19:20:41 +0000 (UTC)
Ovid via perl5-porters <perl5-porters@perl.org> 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:

  https://github.com/leonerd/perl5/tree/module

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
Exporter.pm.


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

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

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