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

Re: mauve::reftype()

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
August 30, 2010 00:42
Subject:
Re: mauve::reftype()
Message ID:
20100830074226.GC48531@plum.flirble.org
On Sun, Aug 29, 2010 at 09:58:40PM -0400, David Golden wrote:
> On Sun, Aug 29, 2010 at 6:57 PM, demerphq <demerphq@gmail.com> wrote:
> > I have pushed a patch to add "fixed" versions of reftype, refaddr and
> > blessed to universal.c, additionally
> > at jesse's request this includes weaken() (and its relative isweak).
> >
> > I used the namespace "mauve" for now.
> >
> > I think the namespace should either be 'ref' or 'scalar'.
> 
> I'm late to the debate, but on the nitpicky issue of namespace, I
> would have preferred you just picked one instead of a fake one.  A
> fake one guarantees we have to change it.  A plausible one stands a
> chance of not changing.

I don't like the use of a built-in namespace for this.

Historically, functions intended for general use have either

1: have been keywords, and in the core

or

2: been in namespaces, and loaded via require or use
   (where that load causes an actual load an initialisation)

> More generally, I question the benefit (wisdom) of jamming things into
> universal.c.  Why not fix Scalar::Util?  Why not make them proper
> keywords protected by 'feature'?

We weren't convinced that it was viable to change the behaviour of
well used Scalar::Util functions this late in the game.

> After considering it briefly, I think that if "everyone needs them",
> then they should be keywords under feature.  If not, then they should
> be in a module and Scalar::Util should just be fixed.  If it varies by
> function, then split them up accordingly.

This is generally my feeling too. I don't like a "third way" in the middle.

> FWIW, I've always thought that blessed and weaken should be core
> keywords.  The others strike me as more specialized functions that
> could just live in a fixed Scalar::Util and imported when needed.

However, it also strikes me that we already have a namespace for core keywords,
%CORE::

So if (at least) all the feature-enabled keywords were also subroutines in
that namespace, it provides a way to get at them without use 'feature'

Nicholas Clark


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