From: "Víctor Adrián de la Cruz Serrano" Date: 2009-11-13T01:47:31+09:00 Subject: Re: Need help to detect error 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ó: > 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íctor Adrián > > > Or anyone knows where can I contact some YAML guys to help me with this > > obscure problem? > > > > El mié, 11-11-2009 a las 16:58 +0900, Víctor Adrián de la Cruz Serrano > > escribió: > > > 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"? > > > > > > > > > ================================================================= > > > # FAILING EXAMPLE > > > ================================================================= > > > class Battlefield > > > attr_accessor :teams > > > def initialize > > > @teams = [] > > > end > > > def add_team(team) > > > @teams << team > > > team.bparent = self > > > end > > > end > > > > > > class Team > > > attr_accessor :members, :bparent > > > def initialize > > > @members = [] > > > @bparent = nil > > > end > > > def add_member(child) > > > @members << child > > > child.team = self > > > end > > > end > > > > > > class Warrior > > > attr_accessor :team > > > def initialize > > > @team = nil > > > end > > > end > > > > > > w = Warrior.new > > > t = Team.new > > > t.add_member(w) > > > b = Battlefield.new > > > b.add_team(t) > > > b.inspect > > > #Convert to YAML and back > > > y = 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 > > > > > > > > > ================================================================= > > > # GOOD EXAMPLE > > > ================================================================= > > > require 'yaml' > > > > > > class Battlefield > > > attr_accessor :teams > > > def initialize > > > @teams = [] > > > end > > > def add_team(team) > > > @teams << team > > > team.parent = self > > > end > > > end > > > > > > class Team > > > attr_accessor :members, :parent > > > def initialize > > > @members = [] > > > @parent = nil > > > end > > > def add_member(child) > > > @members << child > > > child.team = self > > > end > > > end > > > > > > class Warrior > > > attr_accessor :team > > > def initialize > > > @team = nil > > > end > > > end > > > > > > w = Warrior.new > > > t = Team.new > > > t.add_member(w) > > > b = Battlefield.new > > > b.add_team(t) > > > b.inspect > > > #Convert to YAML and back > > > y = 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 > > > > > > > > > > > > > > > > >