Giter Site home page Giter Site logo

Comments (7)

 avatar commented on July 28, 2024

test case: https://gist.github.com/1974317 (sorry, i tried to include it a couple times but didn't know what I was doing)

from psych.

tenderlove avatar tenderlove commented on July 28, 2024

I'm not totally opposed, but y has been defined on kernel since 1.8 (even when requiring syck):

[aaron@higgins rails (master)]$ ruby -v -ryaml -e'p method(:y)'
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
#<Method: Object(Kernel)#y>
[aaron@higgins rails (master)]$

Do you have suggestions for a replacement that would be backwards compatible, yet still provide the y method?

from psych.

 avatar commented on July 28, 2024

I'm not sure if there's a way to provide the y method without adding it to the Kernel module. There is an easy way to fix it from the Parslet side: the Context class extends from BlankSlate, but in the future it should probably extend BasicObject (this prevents Kernel from being included and fixes the problem). I'm guessing it's using BlankSlate for now for backwards compatibility reasons; BasicObject was only added in 1.9.3.

This only manifests itself in 1.9.3 because Psych became the default yml parser. I'm questioning the usefulness of this method, given that it's added as private and would probably only be used for debugging purposes (though admittedly, I'm new to Psych and haven't gone too deep into anything that uses it). Maybe add a deprecation warning when that method is called, and then removing it in a future release?

from psych.

tenderlove avatar tenderlove commented on July 28, 2024

I'm guessing if you do require "syck" on 1.9.3, you'll get the same issue. I don't think it's unique to just psych.

I think we could push the y method up to Object and everything would still work, but I'd rather just remove the method. The only time I use this method is inside irb, so maybe conditionally loading it if irb is present would be a sufficient compromise.

from psych.

kschiess avatar kschiess commented on July 28, 2024

I'll fix it on the parslet side as well. This kind of namespace pollution is rather frequent in Ruby libraries and really hinders interop. My fix will be to really define methods instead of using method_missing.

Join the holy crusade: jimweirich/rake#81

;)

from psych.

 avatar commented on July 28, 2024

I'm fine with whatever works - the irb solution sounds fine, if there's an easy way to detect that. I've already patched the code on my end, so I'm not too worried about it; just wanted to make sure that nobody would run into the same issue.

from psych.

kschiess avatar kschiess commented on July 28, 2024

The newest release of parslet (1.3.0) contains the fix.

from psych.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.