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

Re: Pre-RFC: a `module` keyword

Thread Previous | Thread Next
From:
Darren Duncan
Date:
January 25, 2022 03:26
Subject:
Re: Pre-RFC: a `module` keyword
Message ID:
f8d98314-78da-d867-ae1b-447377158738@darrenduncan.net
On 2022-01-24 11:20 a.m., 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. It would complement Corinna syntax ...

I realize that Raku has the module+class duality, but how does it help Perl that 
Corinna hasn't already done?

Is the point that "module" is for routines that do NOT have associated private 
storage like static/shared class fields?

Does Corinna have the concept of static classes like Java/etc where one can 
declare a class but can not instantiate an instance/object of it and the class 
methods can only be used as "ClassName::method_name()" or exported as 
"method_name()"?

If Corinna does NOT have classes that can't be instantiated as objects, then I 
see a value to have a "module" which fills the standalone never used with an 
object role.

But if Corinna does support static/non-instantiable classes, then I see no 
reason to have "module" too.

Or if "module" exists, then Corinna should be that all classes must be 
instantiable, even if they are singletons due to having no fields.

-- Darren Duncan

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