There is no XS code involved
Uh, I bet DBI is "involved" which usually means quite a large amount of XS code. Moose is mentioned which pulls in a ton of other modules, several of which involve XS code.
And I already noted that XS bugs have a tendency (IMO, IME) to impact things that don't appear at all related:
probably one of the major contributors to the rather frequent problems I see with "weird bugs" that just "go away" when some XS module stops being used (even though the XS module doesn't even seem related to the "weird bug").
(emphasis added)
it makes no sense to have the quoting in the first place
Several people appear to disagree with you on that point. If you want to argue against them, then perhaps you should address their points rather than throw out just "it makes no sense" (to you) and "it's unorthodox" (in your experience).
Several objects are being used as keys to hashes. It is very similar to "inside out object" techniques. Yes, "inside out objects" were rather unorthodox until they became rather mainstream and even a widely adopted "best practice" (and have fallen out of favor a bit since, IME).
So I don't find it unacceptable to keep this key around. Nor do I object to avoiding the creation of circular references (or even just avoiding some risk of circular references). Hash keys are just strings so "$self" is how you get the hash key.
And it CAUSES a bug.
Well, for some less useful definitions of "causes", I guess. It certainly isn't the root cause of the bug, IMO. Based on the somewhat vague description of the bug, it sounds to me like a bug that should be impossible to create just in Perl code.
It should be impossible for one to write Perl code such that
my $x= get();
my $y= $x->method();
# vs.
my $z= get()->method();
produce different results.
So I stand by my assertion that there must be a real bug in some non-Perl code (either XS code or Perl's own C code -- XS code being the much more likely case) for this to happen (though the problem statement is vague enough that I could easily be misunderstanding).
So it would be good for somebody to do some more debugging in hopes of finding or at least narrowing down the location of this other bug.
The code of DBIx::Simple is complex enough that I was not able to quickly understand the interplay of object life cycles. I have no confidence that changing "$self" to $self won't "CAUSE" bugs for other users of that module.
So it would be good to provide some complete, stand-alone code that reproduces this problem so it can at least be added to the test suite for the module (probably marked "to-do" for now).
If somebody makes the effort to understand the interplay of object life cycles, then it would be good to add some test cases around such things as well. Then we might even be able to point at a specific case that would be broken by the proposed change. Or be able to point at the tests around how life cycles are supposed to interact and how the proposed change doesn't break any of those tests.
|