Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
something wrong with argument binding in function calls
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
 
Abhijit Mahabal  
View profile  
 More options Mar 2 2005, 12:21 pm
Newsgroups: perl.perl6.compiler
From: amaha...@cs.indiana.edu (Abhijit Mahabal)
Date: Wed, 02 Mar 2005 12:21:56 -0500
Local: Wed, Mar 2 2005 12:21 pm
Subject: something wrong with argument binding in function calls
the file examples/hanoi.p6 should work correctly, but does not.
Something is going wrong in the recursion.

=========================
[amahabal@satchel trunk]$ ./pugs examples/hanoi.p6
ndisks = 3
AS
AS
SS
AB
SS
SB
SB
=========================

A modified version that also prints out what arguments the function saw
spews this out:

=========================
[amahabal@satchel trunk]$ ./pugs ../../b2.p6 3
ndisks = 3
Called for 3 discs with A B S
Called for 2 discs with A S S
Called for 1 discs with A S S
Called for 0 discs with A S S
Disk 1 from A to S
Called for 0 discs with S S S
......
=========================

So something is wrong somewhere. Could it be that the function is
treating its variables not as "my" but something else? That is my guess,
but that something else is not the perl5 "local" or the perl5 "our"
because they would not produce this particular error.

I plan to explore this more later today.

--abhijit


    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.
Abhijit Mahabal  
View profile  
 More options Mar 2 2005, 1:13 pm
Newsgroups: perl.perl6.compiler
From: amaha...@cs.indiana.edu (Abhijit Mahabal)
Date: Wed, 02 Mar 2005 13:13:52 -0500
Local: Wed, Mar 2 2005 1:13 pm
Subject: Re: something wrong with argument binding in function calls
A simpler buggy version:
====================
sub g($x, $y){
   say "$x $y";
   h($y, $x);

}

sub h($x, $y){
   say "$x $y";

}

g(10, 15);
=====================
This prints:
10 15
15 15

--abhijit


    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.
Jonathan Scott Duff  
View profile  
 More options Mar 2 2005, 2:18 pm
Newsgroups: perl.perl6.compiler
From: d...@pobox.com (Jonathan Scott Duff)
Date: Wed, 2 Mar 2005 13:18:27 -0600
Local: Wed, Mar 2 2005 2:18 pm
Subject: Re: something wrong with argument binding in function calls

On Wed, Mar 02, 2005 at 12:21:56PM -0500, Abhijit Mahabal wrote:
> the file examples/hanoi.p6 should work correctly, but does not.
> Something is going wrong in the recursion.
[ *poof* ]

> I plan to explore this more later today.

Great! I'd checked that example in knowing that there was a problem, but
I haven't had the time to track it down. Perhaps your simpler exposition
of the problem could be the basis of a good test.

-Scott
--
Jonathan Scott Duff
d...@pobox.com


    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.
End of messages
« Back to Discussions « Newer topic     Older topic »

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