Reply to topic  [ 3 posts ] 
Save fails when given a single void variable 
Author Message
Yorick Master

Joined: Wed Jun 01, 2005 11:34 am
Posts: 112
Post Save fails when given a single void variable
When called with two or more void variables, save works. When called with a single non-void variable, save works. However, save does not seem able to distinguish between a call to save with a single void variable and a call to save without any variables. The following illustrates:

Code:
> info, save()
object with 0 members:
> info, save(test)
object with 0 members:
> test=[]
> info, save(test)
object with 0 members:
> info, save(test1, test2)
object with 2 members:
   test1 = []
   test2 = []
> test=1
> info, save(test)
object with 1 members:
   test = array(long)
>


Tue Aug 24, 2010 7:46 am
Profile
Yorick Master

Joined: Mon Nov 22, 2004 9:43 am
Posts: 354
Location: Livermore, CA, USA
Post 
I just committed the fix to this bug.

I'd like to point out an important error in your description:

In yorick, save() is a call to the save function with a single nil argument. There is a hole in the yorick language that makes it impossible to call a function with no arguments, as a function. You can only call a function with no arguments as a subroutine, discarding any return value. This is a difference between yorick and, for example, C semantics. I long ago decided to live with the hole, rather than attempting to plug it.

So the bug was, in the failure to recognize the fact that even though the value of the argument was nil, the argument was a reference to a variable. The fix is not "perfect". For example, save(call()) also works -- any expression whose value is nil will return an empty object, though I would prefer that it raise an error. But I don't believe this will cause any serious problems, and there is no easy way to fix the infelicity.


Sat Aug 28, 2010 5:02 pm
Profile
Yorick Master

Joined: Wed Jun 01, 2005 11:34 am
Posts: 112
Post 
This also now works as expected for me. Thanks for the fix!


Wed Sep 01, 2010 7:24 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.