Exists and Delete
flag
7 messages - Collapse all
/groups/adfetch?adid=FJ6OIxAAAABLH5XgiYwjNMJ0LBOxvWma
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
 
1.  Rod Adams  
View profile  
 More options Mar 15 2005, 2:12 am
Newsgroups: perl.perl6.language
From: r...@rodadams.net (Rod Adams)
Date: Tue, 15 Mar 2005 01:12:31 -0600
Local: Tues, Mar 15 2005 2:12 am
Subject: Exists and Delete
How am I supposed to define a signature that says "A scalar that refers
to a hash or array element, but do not evaluate or autovivify the element"?

Or are these two are now strictly methods without functional forms?

-- Rod Adams


    Reply to author    Forward  
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.
2.  Thomas Sandlaß  
View profile  
 More options Mar 15 2005, 12:57 pm
Newsgroups: perl.perl6.language
From: Thomas.Sandl...@orthogon.com (Thomas Sandlaß)
Date: Tue, 15 Mar 2005 18:57:02 +0100
Local: Tues, Mar 15 2005 12:57 pm
Subject: Re: Exists and Delete

Rod Adams wrote:
> How am I supposed to define a signature that says "A scalar that refers
> to a hash or array element, but do not evaluate or autovivify the element"?

I'll make a guess: Ref of Int of Array.
This assumes Int has a polymorphic subtype that allows
pointing into arrays. But unfortunately you need two values
to describe the reference: the index and the array. So it should
be more like a pair: Ref of Pair[Int,Array].

my @array;
my Ref of Int of Array $iref = 17 of $array; # 17 => @array perhaps

$iref = "blahh";
say "@array[17]"; # prints blahh

> Or are these two are now strictly methods without functional forms?

Sorry I don't know what you are asking for. What is then a method with
functional form? Do you mean that the entries in an array are off-limits
to the outside and can be accessed only by the subscripting methods?

Regards,
--
TSa (Thomas Sandlaß)


    Reply to author    Forward  
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.
3.  Rod Adams  
View profile  
 More options Mar 15 2005, 1:44 pm
Newsgroups: perl.perl6.language
From: r...@rodadams.net (Rod Adams)
Date: Tue, 15 Mar 2005 12:44:06 -0600
Local: Tues, Mar 15 2005 1:44 pm
Subject: Re: Exists and Delete

What I'm asking is if we are going to continue allowing:

  delete %x<foo>;
  if exists %x<foo> { ... }

or make it where you instead have to say

 %x.delete('foo');
 if %x.exists('foo') { ... }

-- Rod Adams


    Reply to author    Forward  
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.
4.  Juerd  
View profile  
 More options Mar 15 2005, 1:47 pm
Newsgroups: perl.perl6.language
From: ju...@convolution.nl (Juerd)
Date: Tue, 15 Mar 2005 19:47:58 +0100
Local: Tues, Mar 15 2005 1:47 pm
Subject: Re: Exists and Delete
Rod Adams skribis 2005-03-15 12:44 (-0600):

> %x.delete('foo');
> if %x.exists('foo') { ... }

Would renaming exists to has or hasa be a good idea, if it does indeed
exist only in method form?

Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html


    Reply to author    Forward  
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.
5.  Larry Wall  
View profile  
 More options Mar 15 2005, 2:20 pm
Newsgroups: perl.perl6.language
From: la...@wall.org (Larry Wall)
Date: Tue, 15 Mar 2005 11:20:54 -0800
Local: Tues, Mar 15 2005 2:20 pm
Subject: Re: Exists and Delete
On Tue, Mar 15, 2005 at 07:47:58PM +0100, Juerd wrote:

: Rod Adams skribis 2005-03-15 12:44 (-0600):
: > %x.delete('foo');
: > if %x.exists('foo') { ... }
:
: Would renaming exists to has or hasa be a good idea, if it does indeed
: exist only in method form?

I'd think that would be asking if the array has an *attribute* of
that name.  Perl 6 objects aren't hashes...

Larry


    Reply to author    Forward  
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.
6.  Juerd  
View profile  
 More options Mar 15 2005, 2:22 pm
Newsgroups: perl.perl6.language
From: ju...@convolution.nl (Juerd)
Date: Tue, 15 Mar 2005 20:22:37 +0100
Local: Tues, Mar 15 2005 2:22 pm
Subject: Re: Exists and Delete
Larry Wall skribis 2005-03-15 11:20 (-0800):

> On Tue, Mar 15, 2005 at 07:47:58PM +0100, Juerd wrote:
> : Rod Adams skribis 2005-03-15 12:44 (-0600):
> : > %x.delete('foo');
> : > if %x.exists('foo') { ... }
> : Would renaming exists to has or hasa be a good idea, if it does indeed
> : exist only in method form?
> I'd think that would be asking if the array has an *attribute* of
> that name.  Perl 6 objects aren't hashes...

That makes sense. I think %x ~~ 'foo' will be used more than
%x.exists('foo') anyway.

Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html


    Reply to author    Forward  
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.
7.  Larry Wall  
View profile  
 More options Mar 15 2005, 1:58 pm
Newsgroups: perl.perl6.language
From: la...@wall.org (Larry Wall)
Date: Tue, 15 Mar 2005 10:58:20 -0800
Local: Tues, Mar 15 2005 1:58 pm
Subject: Re: Exists and Delete
On Tue, Mar 15, 2005 at 12:44:06PM -0600, Rod Adams wrote:

: What I'm asking is if we are going to continue allowing:
:
:  delete %x<foo>;
:  if exists %x<foo> { ... }
:
: or make it where you instead have to say
:
: %x.delete('foo');
: if %x.exists('foo') { ... }

They can always just be macros that translate the unary form to the
method.  If you define them as term:<delete> and term:<exists> they
won't show up unexpectedly when the parser is looking for method names.

Larry


    Reply to author    Forward  
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.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google