From: Judson Lester Date: 2009-11-17T05:00:26+09:00 Subject: Re: Need help to detect error --00504502cb1fcfdb2a04788275c0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The single character difference tends to corroborate the cause of the bug: the reference that's generated by #to_yaml fails if it comes earlier in the map - first, not last, not sure the details. As to where to post bugs, Syck has been accepted into the standard library (one of many incredible contributions by _why) so I'd imagine that the bugs would be posted to http://redmine.ruby-lang.org/ Judson 2009/11/12 V=C3=ADctor Adri=C3=A1n > Yeah, but I don't know where exactly should I report it. What is the > link to their bug tracker? > > Exactly, the difference is only one char. > And I have found that it works with words like: parent, parenta, > parenton, parent. > But it fails with words like: battle, battlefield, bparent. > > Strange, isn't it? > > El jue, 12-11-2009 a las 09:41 +0900, Judson Lester escribi=C3=B3: > > That's bizarre. All that I can see that's different is because the > failing > > version uses the attribute "bparent" and the other uses "parent", the > > backreferences occur in different places in the resulting YAML. I > believe > > that Syck was taking over when _why left - you ought to file a bug. > > > > (Unless there's an obscure YAML rule that backreferences have to occur > after > > literal values...) > > > > Judson > > > > 2009/11/11 V=C3=ADctor Adri=C3=A1n > > > > > Or anyone knows where can I contact some YAML guys to help me with th= is > > > obscure problem? > > > > > > El mi=C3=A9, 11-11-2009 a las 16:58 +0900, V=C3=ADctor Adri=C3=A1n de= la Cruz Serrano > > > escribi=C3=B3: > > > > I don't know what am I doing wrong, can anyone help me? > > > > These two programs look very similar, but they yield different > results. > > > > Can anyone confirm this "error"? > > > > > > > > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > # FAILING EXAMPLE > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > class Battlefield > > > > attr_accessor :teams > > > > def initialize > > > > @teams =3D [] > > > > end > > > > def add_team(team) > > > > @teams << team > > > > team.bparent =3D self > > > > end > > > > end > > > > > > > > class Team > > > > attr_accessor :members, :bparent > > > > def initialize > > > > @members =3D [] > > > > @bparent =3D nil > > > > end > > > > def add_member(child) > > > > @members << child > > > > child.team =3D self > > > > end > > > > end > > > > > > > > class Warrior > > > > attr_accessor :team > > > > def initialize > > > > @team =3D nil > > > > end > > > > end > > > > > > > > w =3D Warrior.new > > > > t =3D Team.new > > > > t.add_member(w) > > > > b =3D Battlefield.new > > > > b.add_team(t) > > > > b.inspect > > > > #Convert to YAML and back > > > > y =3D YAML.load(b.to_yaml) > > > > #Now have a look at the "members" array inside a team... it's gone > > > > y.inspect > > > > y.teams.first.members.inspect > > > > > > > > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > # GOOD EXAMPLE > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > require 'yaml' > > > > > > > > class Battlefield > > > > attr_accessor :teams > > > > def initialize > > > > @teams =3D [] > > > > end > > > > def add_team(team) > > > > @teams << team > > > > team.parent =3D self > > > > end > > > > end > > > > > > > > class Team > > > > attr_accessor :members, :parent > > > > def initialize > > > > @members =3D [] > > > > @parent =3D nil > > > > end > > > > def add_member(child) > > > > @members << child > > > > child.team =3D self > > > > end > > > > end > > > > > > > > class Warrior > > > > attr_accessor :team > > > > def initialize > > > > @team =3D nil > > > > end > > > > end > > > > > > > > w =3D Warrior.new > > > > t =3D Team.new > > > > t.add_member(w) > > > > b =3D Battlefield.new > > > > b.add_team(t) > > > > b.inspect > > > > #Convert to YAML and back > > > > y =3D YAML.load(b.to_yaml) > > > > #Now have a look at the "members" array inside a team, it's still > there > > > > y.inspect > > > > y.teams.first.members.inspect > > > > > > > > > > > > > > > > > > > > > > > > > > > > --00504502cb1fcfdb2a04788275c0--