Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
'wrap' from S6
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
David Storrs  
View profile  
 More options Apr 16 2003, 10:49 am
Newsgroups: perl.perl6.language
From: dsto...@dstorrs.com (David Storrs)
Date: Wed, 16 Apr 2003 07:44:04 -0700
Local: Wed, Apr 16 2003 10:44 am
Subject: 'wrap' from S6
From S6:
----
The call to .wrap returns a unique identifier that can later be passed
to the .unwrap method, to undo the wrapping:

    &thermo.unwrap($id);
----

Can we add a suppressable warning (similar to "useless use of <foo> in
void context") that says "Id of wrapped function not stored; you will
not be able to unwrap '<foo>'"?

--Dks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adam D. Lopresto  
View profile  
 More options Apr 16 2003, 11:48 am
Newsgroups: perl.perl6.language
From: a...@pubcrawler.org (Adam D. Lopresto)
Date: Wed, 16 Apr 2003 10:07:03 -0500 (CDT)
Local: Wed, Apr 16 2003 11:07 am
Subject: Re: 'wrap' from S6

> >From S6:
> ----
> The call to .wrap returns a unique identifier that can later be passed
> to the .unwrap method, to undo the wrapping:

>     &thermo.unwrap($id);
> ----

> Can we add a suppressable warning (similar to "useless use of <foo> in
> void context") that says "Id of wrapped function not stored; you will
> not be able to unwrap '<foo>'"?

Hmmm, I don't think that's necessary.  Actually, I wouldn't be surprised in the
least if perl had the introspective power to unwrap a subroutine without that
$id, and if it doesn't I don't see the purpose in forcing it being stored if
you never want to undo the wrap.

However, I do wonder whether the unwrap is as streamlined as it could be.

  &thermo.unwrap($id);

looks to me like you need to store two things if you want to be able to undo a
wrap, and one is wholy dependant on the other.  Why can't the identifier
returned be some structure that contains both?

  $handle = &thermo.wrap(&wrapper);
    .
    .
    .
  $handle.unwrap();

It particularly seems useful if you're writing a module that wraps many subs.
There's no reason you should have to store references to all the subs along
with the ids.  Actually, I'd argue that .unwrap could be named .undo, and in
general other things could return a handle that could undo them, though I can't
think of any examples off the top of my head.
--
Adam Lopresto
http://cec.wustl.edu/~adam/

perl -le '$_=(split q,",,`$^Xdoc -q japh`)[1].".";y/pj/PJ/;print'


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Austin Hastings  
View profile  
 More options Apr 16 2003, 1:48 pm
Newsgroups: perl.perl6.language
From: austin_hasti...@yahoo.com (Austin Hastings)
Date: Wed, 16 Apr 2003 09:59:39 -0700 (PDT)
Local: Wed, Apr 16 2003 12:59 pm
Subject: Re: 'wrap' from S6

--- David Storrs <dsto...@dstorrs.com> wrote:

> From S6:
> ----
> The call to .wrap returns a unique identifier that can later be
> passed
> to the .unwrap method, to undo the wrapping:

>     &thermo.unwrap($id);
> ----

> Can we add a suppressable warning (similar to "useless use of <foo>
> in
> void context") that says "Id of wrapped function not stored; you will
> not be able to unwrap '<foo>'"?

Only with perl6 -w:IrksomeBanalPedantic :)

I think this is one of those things like setting the separator char --
if you do it, you know what you're doing. If you don't save the id, you
didn't want the id.

=Austin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »