develooper Front page | perl.perl5.porters | Postings from August 2021

Re: PSC #034 2021-08-20 - "Namespaces Special"

Thread Previous | Thread Next
From:
Dan Book
Date:
August 30, 2021 05:13
Subject:
Re: PSC #034 2021-08-20 - "Namespaces Special"
Message ID:
CABMkAVXVX35FrAm95gd51Wzjss259gLy_FcqDdSAyt1pqESe7g@mail.gmail.com
On Mon, Aug 30, 2021 at 1:09 AM Yuki Kimoto <kimoto.yuki@gmail.com> wrote:

>
> 2021-8-30 13:30 Dan Book <grinnz@gmail.com> wrote:
>
>> On Sun, Aug 29, 2021 at 11:46 PM Yuki Kimoto <kimoto.yuki@gmail.com>
>> wrote:
>>
>>>
>>> 2021-8-27 21:08 Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> wrote:
>>>
>>>>
>>>>         #!perl
>>>>         use v5.40;
>>>>         say "The reftype of arrays is ", reftype [];
>>>>
>>>>
>>>>
>>> There is one point I would like PSC to add to the discussion.
>>>
>>> Are all builtin functions imported to the "main" namespace?
>>>
>>> Or, are just only the functions we consider very important imported
>>> to the "main" namespace?
>>>
>>> I would like to add this to the discussion because the "main" namespace
>>> is also the user's space, so smaller conflicts are better.
>>>
>>
>> It won't go into any namespace if it is implemented as a lexical keyword
>> like you get from feature.pm.
>>
>> -Dan
>>
>
> >> And furthermore, builtins are not in main either, they are in CORE.
>
> Dan, thank you for the information.
>
> From now on, I will say CORE.
>
> I understand that is lexical.
>
> My point is that already imported user functions need fully qualified
> names.
>
> For example, Think about that the generic name ”get" is added to CORE
> namespace.
>
> User "get" function needs a fully qualified name.
>
>   # Old code
>   use Foo 'get';
>
>   get '/aaa';
>
>   # New code
>   use v5.40;
>
>   use Foo ();
>
>   Foo::get '/aaa';
>
> So I feel it would be better to have fewer collisions.
>

Imported symbols override builtins already, this is how modules like
autodie and Time::HiRes work. But yes, this chance of collision is
unavoidable and we have to take more care with more common names.

-Dan

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