Reply to topic  [ 3 posts ] 
merge oxy group with anonymous member 
Author Message
Yorick Guru

Joined: Thu May 10, 2007 12:07 pm
Posts: 62
Post merge oxy group with anonymous member
Hello,

I found a non expecting behavior when one want to merge oxy object with anonymous members using save.

Here what it works:
Code:
> a = save();
> b = save( "1", 1, "2", 2);
> save, a, [], b;
// As expecting:
> a(*)
2
> a(1)
1
> a(2)
2



But when b is defined with anonymous member:
Code:
> a = save();
> b = save( string() , 1,  string() , 2);
> save, a, [], b;
> a(*);  // that fine
2
> a(1)   //the merged anonymous member are now void
[]
> a(2)
[]


The help of save says:
nil [] - save only: if VALi is not an object, same as string(0),
if VALi is an object, merge with OBJ, that is members of VALi become
members of OBJ, creating or overwriting named members and always
appending anonymous members.

Apparently the anonymous member are not append correctly.

Cheers,
Sylvain.


Fri Mar 04, 2011 6:50 am
Profile
Yorick Guru

Joined: Thu May 10, 2007 12:07 pm
Posts: 62
Post Re: merge oxy group with anonymous member
In oxy.c on line 774 (Y__save function )

It is:
Code:

if (ops->set_q(obj, 0, -1, argc))
    y_error("unable to save by appending anonymous member");


It shoud be
Code:
if (ops->set_q(obj, 0, -1, argc-1))
     y_error("unable to save by appending anonymous member");


Otherwhise the nill argument (in pos argc) is parsed instead of the object itself.


Fri Mar 04, 2011 7:05 am
Profile
Yorick Master

Joined: Mon Nov 22, 2004 9:43 am
Posts: 354
Location: Livermore, CA, USA
Post Re: merge oxy group with anonymous member
Thank you very much. This has the honor of being the first bug fix pushed to the yorick repo at github. You can pull the corrected code from github.com/dhmunro/yorick.

All of you who occasionally make bug fixes like this one to yorick code should consider spending a few moments making your own fork of the yorick source code at github. All you have to do is to click the "Fork" button at github.com/dhmunro/yorick -- this will create a public yorick repo of your own at github. If you clone that repo on your own machines -- instead of my dhmunro/yorick repo -- you will be in a perfect position to contribute patches like this using the very convenient pull request mechanism, while still being able to easily pull any fixes from my "blessed" repo at github. The github site will also track your pull requests, keeping a better record of the history of our source code. Read about forking at help.github.com, and give it a try.


Sat Mar 05, 2011 10:11 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.