Mailing List Archive

Pre-RFC: "builtins" namespace
Hi all,

Following up our recent "Namespaces" chat, I'd like to get the ball
rolling on the subject of the builtin functions namespace idea.

I propose to write an RFC to outline the overall mechanism, and give an
*initial* list of functions to include in it. I say initial, because
the entire point of the mechanism is that's where we'll be adding any
of the "simple, acts like a function" things in future, so this very
much doesn't need to be a full complete list; just a few bits and
pieces to get us started.

To that end I am looking for answers to such questions as:


* What should it be called? Votes on:

use functions 'abc', 'xyz', ...;
use function ...; # because function::abc reads
nicer

use builtins ...
use builtin ...

use std ...

This name would have to be well-behaved as a regular CPAN module,
because the module needs to be dual-life, available to install from
CPAN so older perls can still use the functions it contains.

I therefore feel it should be a single toplevel name, and
all-lowercase. I have no strong thoughts about singular vs. plural
as a name.


* What *initial* set of functions to put in it? [again see comment
above]. So far I'm thinking:

trimmed($str) # which started this whole discussion off

refaddr($ref), reftype($ref), etc... # from Scalar::Util

getcwd() # Seriously, because currently we have one in
Internals:: of all places, and that really needs to
disappear.


* Any other important considerations we've missed


Try to keep comments brief - remember this is a *pre*RFC chat of
"should we write this RFC at all?", rather than fine-tuning inner
details of the idea. That can be handled separately as comments on the
actual RFC as it gets written.

Also try to avoid comments of "please add ${my pet favourite function}"
- as I said this is just an initial list of function names to get the
mechanism itself in place. Once we have something, we can take ideas on
more functions on a case-by-case basis.

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: Pre-RFC: "builtins" namespace [ In reply to ]
On Fri, Sep 10, 2021 at 2:47 PM Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
wrote:

> Hi all,
>
> Following up our recent "Namespaces" chat, I'd like to get the ball
> rolling on the subject of the builtin functions namespace idea.
>
> I propose to write an RFC to outline the overall mechanism, and give an
> *initial* list of functions to include in it. I say initial, because
> the entire point of the mechanism is that's where we'll be adding any
> of the "simple, acts like a function" things in future, so this very
> much doesn't need to be a full complete list; just a few bits and
> pieces to get us started.
>
> To that end I am looking for answers to such questions as:
>
>
> * What should it be called? Votes on:
>
> use functions 'abc', 'xyz', ...;
> use function ...; # because function::abc reads
> nicer
>
> use builtins ...
> use builtin ...
>
> use std ...
>
> This name would have to be well-behaved as a regular CPAN module,
> because the module needs to be dual-life, available to install from
> CPAN so older perls can still use the functions it contains.
>
> I therefore feel it should be a single toplevel name, and
> all-lowercase. I have no strong thoughts about singular vs. plural
> as a name.
>

CPAN permissions for the suggested names:

function: not in use, but https://metacpan.org/author/PERRAD has comaint on
it, it has no firstcome, possibly a pause artifact that could be reclaimed
functions: available
builtin: not in use, but owned by https://metacpan.org/author/GBARR
builtins: available
std: currently in use and owned by https://metacpan.org/dist/STD

You can check additional names on https://cpanmeta.grinnz.com/perms

-Dan
Re: Pre-RFC: "builtins" namespace [ In reply to ]
On Fri, Sep 10, 2021 at 5:35 PM Dan Book <grinnz@gmail.com> wrote:

> std: currently in use and owned by https://metacpan.org/dist/STD
>

Just to clarify, it's "currently in use" as in it can be installed via that
name; it appears to be a Perl 6 grammar proposal from 2010 and is likely
unused currently in practice... additionally, the namespace is actually
owned by https://metacpan.org/author/WSNYDER who has not uploaded this
dist, so it may be claimable from this user.

-Dan
Re: Pre-RFC: "builtins" namespace [ In reply to ]
2021-9-11 3:47 Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> wrote:

>
> To that end I am looking for answers to such questions as:
>
>
> * What should it be called? Votes on:
>
> use functions 'abc', 'xyz', ...;
> use function ...; # because function::abc reads
> nicer
>
> use builtins ...
> use builtin ...
>
> use std ...
>
>
I'm not interested in the name itself.

There are some things to consider.

- short name because these are frequently called functions(My hope is
within 3 characters).
- at least two characters because 1 character name cause bugs (for example,
priority with -f)
- easy to understand

I can accept the vote of the core team about the name of the builtin
namespace.
Re: Pre-RFC: "builtins" namespace [ In reply to ]
I think calling the namespace builtins is a good idea for describing its
purpose well (self-explanation).


On Mon, Sep 13, 2021 at 7:46 AM Yuki Kimoto <kimoto.yuki@gmail.com> wrote:

>
> 2021-9-11 3:47 Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> wrote:
>
>>
>> To that end I am looking for answers to such questions as:
>>
>>
>> * What should it be called? Votes on:
>>
>> use functions 'abc', 'xyz', ...;
>> use function ...; # because function::abc reads
>> nicer
>>
>> use builtins ...
>> use builtin ...
>>
>> use std ...
>>
>>
> I'm not interested in the name itself.
>
> There are some things to consider.
>
> - short name because these are frequently called functions(My hope is
> within 3 characters).
> - at least two characters because 1 character name cause bugs (for
> example, priority with -f)
> - easy to understand
>
> I can accept the vote of the core team about the name of the builtin
> namespace.
>
>
Re: Pre-RFC: "builtins" namespace [ In reply to ]
2021-9-11 3:47 Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> wrote:

>
> use functions 'abc', 'xyz', ...;
> use function ...; # because function::abc reads
> nicer
>
> use builtins ...
> use builtin ...
>
> use std ...
>
>
Candidates

functions
function
builtins
builtin
std

I add

func
fnc
fn

STD.pm, Func.pm are already on CPAN.
Re: Pre-RFC: "builtins" namespace [ In reply to ]
On Fri, 10 Sep 2021 19:46:35 +0100, "Paul \"LeoNerd\" Evans"
<leonerd@leonerd.org.uk> wrote:

> Hi all,
>
> Following up our recent "Namespaces" chat, I'd like to get the ball
> rolling on the subject of the builtin functions namespace idea.
>
> I propose to write an RFC to outline the overall mechanism, and give
> an *initial* list of functions to include in it. I say initial,
> because the entire point of the mechanism is that's where we'll be
> adding any of the "simple, acts like a function" things in future, so
> this very much doesn't need to be a full complete list; just a few
> bits and pieces to get us started.
>
> To that end I am looking for answers to such questions as:
>
>
> * What should it be called? Votes on:
>
> use functions 'abc', 'xyz', ...;
> use function ...; # because function::abc reads
> nicer
>
> use builtins ...
> use builtin ...

'builtin' gets my vote FWIM

> use std ...
>
> This name would have to be well-behaved as a regular CPAN module,
> because the module needs to be dual-life, available to install
> from CPAN so older perls can still use the functions it contains.
>
> I therefore feel it should be a single toplevel name, and
> all-lowercase. I have no strong thoughts about singular vs. plural
> as a name.
>
>
> * What *initial* set of functions to put in it? [again see comment
> above]. So far I'm thinking:
>
> trimmed($str) # which started this whole discussion off

even though it is the reason this RFC was started, it is the funtion I
would least care about and use most rarely

> refaddr($ref), reftype($ref), etc... # from Scalar::Util

yes, please

> getcwd() # Seriously, because currently we have one in
> Internals:: of all places, and that really needs to
> disappear.

If getcwd (yes, please), consider abs_path or realpath too. I checked a
few scripts that used getcwd, and most also use abs_path too

I know you did not want pet-names added, but to me this falls into the
if A then B expectation. Intuitiveness.

As mentioned in the other thread, I'd consider strptime and timelocal
(being the timelocal_posix variant)

> * Any other important considerations we've missed

I think it would be the set of functions that complement and/or
complete the existing builtin functions, which is why I mention
timelocal as counterpart of localtime

> Try to keep comments brief - remember this is a *pre*RFC chat of
> "should we write this RFC at all?", rather than fine-tuning inner
> details of the idea. That can be handled separately as comments on the
> actual RFC as it gets written.

--
H.Merijn Brand https://tux.nl Perl Monger http://amsterdam.pm.org/
using perl5.00307 .. 5.33 porting perl5 on HP-UX, AIX, and Linux
https://tux.nl/email.html http://qa.perl.org https://www.test-smoke.org
Re: Pre-RFC: "builtins" namespace [ In reply to ]
On Fri, 10 Sep 2021 19:46:35 +0100
"Paul \"LeoNerd\" Evans" <leonerd@leonerd.org.uk> wrote:

> Hi all,
>
> Following up our recent "Namespaces" chat, I'd like to get the ball
> rolling on the subject of the builtin functions namespace idea.
>
> I propose to write an RFC to outline the overall mechanism, and give
> an *initial* list of functions to include in it. I say initial,
> because the entire point of the mechanism is that's where we'll be
> adding any of the "simple, acts like a function" things in future, so
> this very much doesn't need to be a full complete list; just a few
> bits and pieces to get us started.

And now written:

https://github.com/Perl/RFCs/pull/6

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: Pre-RFC: "builtins" namespace [ In reply to ]
I am not sure where to put this, the GH repo has no way to add
"issues", but 2 points:

1. the non-sequential membership of the ./rfcs makes me want to
look at the rejected ones; I propose there be a folder that contains
these

2. any RFC would be better served as a directory with some sort of
formal structure (i.e., "main" document) then some structure that
allows supporting files and contributions (could be contributed
pro/con arguments, code examples, preliminary benchmark scripts/results
etc) - at some point in the future this process will benefit from
the archiving of this information; including well written "comments"
(the C in rfC). Even for RFCs that are ultimately rejected it would be
beneficial. E.g., a similar feature is proposed but someone remembers
it's suspiciously similar to an older one. This would facilitate some
way to research this imperfect memory.

Finally, I still find it odd that our RFCs are not written in POD.
But I suppose that ship has sailed. I'd much rather see the above
two recommendations (particularly #2) be considered and effected in
some way.

Cheers,
Brett

* Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> [2021-10-16 15:44:04 +0100]:

> On Fri, 10 Sep 2021 19:46:35 +0100
> "Paul \"LeoNerd\" Evans" <leonerd@leonerd.org.uk> wrote:
>
> > Hi all,
> >
> > Following up our recent "Namespaces" chat, I'd like to get the ball
> > rolling on the subject of the builtin functions namespace idea.
> >
> > I propose to write an RFC to outline the overall mechanism, and give
> > an *initial* list of functions to include in it. I say initial,
> > because the entire point of the mechanism is that's where we'll be
> > adding any of the "simple, acts like a function" things in future, so
> > this very much doesn't need to be a full complete list; just a few
> > bits and pieces to get us started.
>
> And now written:
>
> https://github.com/Perl/RFCs/pull/6
>
> --
> Paul "LeoNerd" Evans
>
> leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
> http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/

--
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native
Re: Pre-RFC: "builtins" namespace [ In reply to ]
On Sat, 16 Oct 2021 23:52:04 +0000
Oodler 577 via perl5-porters <perl5-porters@perl.org> wrote:

> 1. the non-sequential membership of the ./rfcs makes me want to
> look at the rejected ones; I propose there be a folder that contains
> these

Numbers are allocated in sequence by PSC at the time the pre-RFC
suggestion graduates to a "please write a full RFC" request. The
missing gaps are ones for which the author has not yet finished a
document as far as the PR stage yet.

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: Pre-RFC: "builtins" namespace [ In reply to ]
* Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> [2021-10-17 00:59:13 +0100]:

> On Sat, 16 Oct 2021 23:52:04 +0000
> Oodler 577 via perl5-porters <perl5-porters@perl.org> wrote:
>
> > 1. the non-sequential membership of the ./rfcs makes me want to
> > look at the rejected ones; I propose there be a folder that contains
> > these
>
> Numbers are allocated in sequence by PSC at the time the pre-RFC
> suggestion graduates to a "please write a full RFC" request. The
> missing gaps are ones for which the author has not yet finished a
> document as far as the PR stage yet.

Oh gotcha, thank you. Well hopefully the second part is under consideration
in some form. Thanks!

Brett

>
> --
> Paul "LeoNerd" Evans
>
> leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
> http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/

--
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native
Re: Pre-RFC: "builtins" namespace [ In reply to ]
2021-10-16 23:44 Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> wrote:

> On Fri, 10 Sep 2021 19:46:35 +0100
> "Paul \"LeoNerd\" Evans" <leonerd@leonerd.org.uk> wrote:
>
> > Hi all,
> >
> > Following up our recent "Namespaces" chat, I'd like to get the ball
> > rolling on the subject of the builtin functions namespace idea.
> >
> > I propose to write an RFC to outline the overall mechanism, and give
> > an *initial* list of functions to include in it. I say initial,
> > because the entire point of the mechanism is that's where we'll be
> > adding any of the "simple, acts like a function" things in future, so
> > this very much doesn't need to be a full complete list; just a few
> > bits and pieces to get us started.
>
> And now written:
>
> https://github.com/Perl/RFCs/pull/6
>
>
>
It looks good to me.