Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

finding the name of &$SUB ?

6 views
Skip to first unread message

David Storrs

unread,
Mar 8, 2005, 12:49:04 AM3/8/05
to perl6-l...@perl.org

Is there a way to find the name of &?SUB ? It would be useful for
error-logging and -reporting.

--Dks

Larry Wall

unread,
Mar 8, 2005, 1:43:46 AM3/8/05
to perl6-l...@perl.org
On Mon, Mar 07, 2005 at 09:49:04PM -0800, David Storrs wrote:
: Is there a way to find the name of &?SUB ? It would be useful for
: error-logging and -reporting.

$?SUBNAME, I think, unless &?SUB just stringifies to that. I guess
it's a good question whether &foo should stringify to "foo" or
"&foo" or something else including the signature. In which case,
&?SUB might stringify to a lot of info, and $?SUBNAME would more
reliably be just the short name. Maybe we also need a way to get
the long name explicitly.

Larry

Uri Guttman

unread,
Mar 8, 2005, 1:55:07 AM3/8/05
to perl6-l...@perl.org
>>>>> "LW" == Larry Wall <la...@wall.org> writes:

LW> On Mon, Mar 07, 2005 at 09:49:04PM -0800, David Storrs wrote:
LW> : Is there a way to find the name of &?SUB ? It would be useful for
LW> : error-logging and -reporting.

LW> $?SUBNAME, I think, unless &?SUB just stringifies to that. I guess
LW> it's a good question whether &foo should stringify to "foo" or
LW> "&foo" or something else including the signature. In which case,
LW> &?SUB might stringify to a lot of info, and $?SUBNAME would more
LW> reliably be just the short name. Maybe we also need a way to get
LW> the long name explicitly.

why not leave it as $?SUB but it is an object and you use the .name
method? this way you won't clutter the namespace and you can add more
methods like .signature, .returns, etc.

uri

--
Uri Guttman ------ u...@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org

Uri Guttman

unread,
Mar 8, 2005, 2:18:45 AM3/8/05
to perl6-l...@perl.org
>>>>> "LW" == Larry Wall <la...@wall.org> writes:

LW> On Tue, Mar 08, 2005 at 01:55:07AM -0500, Uri Guttman wrote:
LW> : why not leave it as $?SUB but it is an object and you use the .name
LW> : method?

LW> Uh, yeah. Obviously, 11 pm is still to early in the day for me...
^^

or too late? :)

(i wouldn't normally spellcheck you but you are usually very accurate
and this must mean something)

and 2am is bedtime for me now.

LW> : this way you won't clutter the namespace and you can add more
LW> : methods like .signature, .returns, etc.

LW> In which case $?SUB and &?SUB are probably just different names for
LW> the same object, or we just go with &?SUB, and assume people will be
LW> able to figure out from the lack of parens that &?SUB.name is not
LW> calling the subroutine. Or I suppose we could go with straight $?SUB.
LW> Or both. Or one. Or the other. Or both. Or...

burble! i know how you feel. now slowly back away from the keyboard and
say nighty night to us all. we need a refreshed larry and not one who
pulls all nighters like some college kid (or damian :).

Larry Wall

unread,
Mar 8, 2005, 2:10:02 AM3/8/05
to perl6-l...@perl.org
On Tue, Mar 08, 2005 at 01:55:07AM -0500, Uri Guttman wrote:
: why not leave it as $?SUB but it is an object and you use the .name
: method?

Uh, yeah. Obviously, 11 pm is still to early in the day for me...

: this way you won't clutter the namespace and you can add more


: methods like .signature, .returns, etc.

In which case $?SUB and &?SUB are probably just different names for


the same object, or we just go with &?SUB, and assume people will be

able to figure out from the lack of parens that &?SUB.name is not

calling the subroutine. Or I suppose we could go with straight $?SUB.

Or both. Or one. Or the other. Or both. Or...

Larry

0 new messages