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

Re: RFC: Amores. Introducing a `module` keyword

Thread Previous
Ovid via perl5-porters
January 25, 2022 21:36
Re: RFC: Amores. Introducing a `module` keyword
Message ID:
Ignore this email. It’s late, I’m tired, and I was being stupid. 

Sent from Yahoo Mail for iPhone

On Tuesday, January 25, 2022, 9:08 PM, Tom Molesworth via perl5-porters <> wrote:

On Wed, 26 Jan 2022 at 00:40, Ovid via perl5-porters <> wrote:

Add a module keyword with basic, modern features to support common Perl use cases.

First off, the idea is interesting but I disagree with the overall concept: this seems to be conflating "we should improve the way libraries of non-OO functions are provided" and "let's apply lots of new defaults". Implementing just the `:export()` attribute seems a much better - and simpler! - option.
The lack of versioning means you're locked in to a particular snapshot of Perl features.
We end up with something that applies to these library files but isn't available in a script... why make that distinction? There's mention of MAIN and extending this to cover scripts, but...
Wouldn't we just put all that `indirect/multi_dimensional/signatures/etc.` into `use 5.038` so that it's available in *all* code? We've already reduced boilerplate to a single line, while making it clear to the Perl interpreter what behaviour we expect.
There are a lot of key technical details missing here, for example:

- what do these exports actually do?
- is there any introspection?

Is it implementing the same mechanism that people would expect from Exporter, i.e. populating the symbol table of the target package? If so, is that guaranteed - can this be used to implement mixins, for example? Or would it allow for subs that are only visible to the caller?

Does @EXPORT get populated? How about @EXPORT_OK, %EXPORT_TAGS?

Can all subs be marked as exported without having to put the `:export` tag on each one? If that's the case, what happens to `our $VERSION`, would that overwrite the caller's copy? Is $VERSION automatically populated by the `:version()` attribute?

What happens if you have `module X { sub import { ... } }`? Can you push imports up a level, e.g. something like `module X { use List::Util qw(min); sub min : export }`?

Why does it have to be a block - can't we have `module X; ...` to avoid that extra indentation level?

Two minor things:
- you mention "Currently, Amores' syntax is almost entirely backwards-compatible because the code does not parse on older Perls that use strict"... then the first example shows that it *does* indeed parse perfectly happily, those are *runtime* errors- getting way offtopic, but... the RFC is in violation of the "civility" core P5P policy: "stick to the facts while avoiding demeaning remarks, belittling other individuals", even if the person is famous, perhaps not appropriate to criticise their ego in a core Perl document

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