dry-rb / dry-logic

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

Rename predicate #respond_to into #responds_to #95

Closed CandyFet closed 1 year ago

CandyFet commented 2 years ago

PR for issue 73

solnic commented 2 years ago

How about interface?(:foo) - it would be consistent with dry-types where we have Types.Interface(:foo)

CandyFet commented 2 years ago

How about interface?(:foo) - it would be consistent with dry-types where we have Types.Interface(:foo)

I am not very familiar with dry gems yet. But i'll look deeply and will add code that ensures successful behaviour with Types.Interface

dgutov commented 1 year ago

@solnic Do you mean to suggest using interface? as the name instead of responds_to??

It might work (especially it it's going to accept multiple arguments). responds_to? is a much more obvious name, though.

flash-gordon commented 1 year ago

IMO, this only adds confusion. The ruby convention uses the infinitive form (has_key? -> have_key?). Either interface? or method? would work I think

solnic commented 1 year ago

I'd be OK with either interface? or method? too.

dgutov commented 1 year ago

IMO, this only adds confusion. The ruby convention uses the infinitive form (has_key? -> have_key?)

I'm following the precedent made by includes?: https://github.com/dry-rb/dry-logic/blob/9e6d7762664b9bc99a4aa4f6f0e7fb8d7a8800ee/lib/dry/logic/predicates.rb#L184-L192

Either interface? or method? would work I think

I don't have a strong opinion (anything would be better than the status quo), but someone might mistake method? for implying the use of Module#method_defined?.

solnic commented 1 year ago

Ah yeah, I guess includes? wasn't a good choice either 😬

dgutov commented 1 year ago

At this point (two years later), I'd say any choice is good enough. As long as it's a change. :-)

Though I guess this particular PR might limit itself to adding a new predicate (in a minor version), for you to remove the obsolete one in the new major (?) version.

solnic commented 1 year ago

I'm gonna go with interface? because we already have Types.Interface in dry-types so this would be consistent.

solnic commented 1 year ago

Closing after all as this was done via #99