ruby-rdf / sparql

Ruby SPARQL library
http://rubygems.org/gems/sparql
The Unlicense
88 stars 14 forks source link

Redefining Array#dup breaks lots of other things #35

Closed cpence closed 4 years ago

cpence commented 4 years ago

After a half-day of debugging, I realized that your redefinition of Array#dup, introduced in 84f36c296ec2d93ecf8f7af77ce8816cd21d7a3b, causes all kinds of things to go haywire in a Rails application. (I was inexplicably no longer able to log in.)

I'm not even a conscious user of your gem, pulling it in via rdf-n3, but could you perhaps roll back that change? I suspect my case isn't the only weird interaction it will produce.

(EDIT: Just to be clear, I've confirmed that all the weird behavior I saw was a result of sparql 3.1.1, and could be fixed by commenting out that one function.)

gkellogg commented 4 years ago

Yes, I can see that this is over broad. Better to create a #deep_dup Method, or something more on point to the general purpose.

I’ll get a patch out shortly.

gkellogg commented 4 years ago

Released 3.1.2 and yanked 3.1.1.

cpence commented 4 years ago

Fantastic, thanks so much!

no-reply commented 4 years ago

should we consider reworking all the standard library monkey patches to use Refinements? this seems like a good use case for them.

gkellogg commented 4 years ago

I thought about that, but have never used them before, but we do patch a number of core classes, and the recent problem was really just my tunnel vision.

If you have some time, perhaps give it a go.