dry-rb / dry-logic

Predicate logic with rule composition
https://dry-rb.org/gems/dry-logic/
MIT License
179 stars 66 forks source link

IRB crash #104

Closed vladimirtemnikov closed 1 year ago

vladimirtemnikov commented 1 year ago

Describe the bug

Hello. Using dry-logic 1.4.0, irb 1.5.0.

As I mentioned in https://github.com/ruby/irb/issues/455, a session crashes if irb's autocomplete feature is enabled.

To Reproduce

Type AnyClass.new. in console. Other details in irb issue link.

Expected behavior

No session crash.

solnic commented 1 year ago

This is because of #73 that will be addressed in dry-logic 2.0

solnic commented 1 year ago

Also see #99 - if there's anything we can do to workaround this for the time being, I'm more than happy to do it

vladimirtemnikov commented 1 year ago

@solnic Thank you for response! I'm not sure, as I see current implementation does not allow to get rid of respond_to?, so may be this could be fixed on irb side, or just wait for dry-logic 2.0 🤔

solnic commented 1 year ago

@vladimirtemnikov yeah this is unfortunate. In other places people worked around it by just checking arity of the respond_to? 😓 I'll be working on dry-logic/schema/validation 2.0.0 shortly after we are done with the release of Hanami 2.0 (which will happen tomorrow).

vladimirtemnikov commented 1 year ago

@solnic sounds great, I guess this conflict could wait a bit then. Thanks for you work! 🚀

solnic commented 1 year ago

@vladimirtemnikov I just realized we can simply do this #105

vladimirtemnikov commented 1 year ago

@solnic elegant solution! ❤️ Didn't even think about this.

kris commented 1 year ago

@solnic did you have a target release date for 2.0?

solnic commented 1 year ago

@kris 2023 Q1

solnic commented 1 year ago

This should work with dry-logic 1.5.0 now 🙂

vladimirtemnikov commented 1 year ago

@solnic Awesome! Thank you so much again ❤️

benjaminoakes commented 1 year ago

Can this be backported to any older versions of dry-logic? It would be helpful to have this fix on dry-logic 1.3.x