Skip to content
This repository has been archived by the owner on May 2, 2020. It is now read-only.

Support "partial dispatch" matches #14

Closed
timholy opened this issue Oct 1, 2014 · 4 comments
Closed

Support "partial dispatch" matches #14

timholy opened this issue Oct 1, 2014 · 4 comments

Comments

@timholy
Copy link

timholy commented Oct 1, 2014

Using the example at MichaelHatherly/Docile.jl#38, suppose I wanted to get help for all push! methods associated with a MyObject. It would be nice to be able to say query(push!, (MyObject,)) or @query push!(myobject), without needing to exactly match the rest of the argument types.

If this can be achieved (and I think my own fledgling efforts at something like Docile, JuliaLang/julia#1619, did something like this), then I think MichaelHatherly/Docile.jl#38 becomes much less important.

@MichaelHatherly
Copy link
Owner

The method version sounds good to me. I assume that Base.tintersect has since been renamed to Base.typeintersect? https://github.com/JuliaLang/julia/pull/1619/files#diff-c20eb2eead14027fab4293e10bacf73bR543.

@query was always meant to have behaviour similar to @which and match an actual method call. I'll try it out as well though and see how it feels.

@MichaelHatherly
Copy link
Owner

@timholy there's basic partial matching for signatures in query now. @query still behaves as before, since I found that having both partial (query) and exact (@query) matching useful. Give me a shout it's not the behaviour you were after.

@timholy
Copy link
Author

timholy commented Oct 2, 2014

It works beautifully. Thanks!

@MichaelHatherly
Copy link
Owner

Great!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants