Closed garborg closed 9 years ago
@amitmurthy Any thoughts on which direction you want to go with this?
Isn't it OK for LibExpat's find
to extend Base.find
? Though the return types are different, the intent is the same and since it works off a LibExpat.ETree
there should be no issues.
I thought performance considerations only arose when a given function implementation returned different types as in http://docs.julialang.org/en/latest/manual/performance-tips/#write-type-stable-functions
If you think extending Base.find is an issue, I would prefer to go with the qualifying option, i.e., keep the name find
.
Sorry, I think I mixed in irrelevant issues -- wasn't trying to say type instability was the thing. Rather that returning the object searched for (rather than the index, as Base.find
does) doesn't fit the pattern for that function, and extending find
anyway because the verb fits, that sounds like the "punning" that is getting rooted out of Base, from what attention I've paid to the language's issue comments.
@vtjnash any thoughts on this? You are the other major user of LibExpat that I know.
@amitmurthy I'm sure @vtjnash has a more informed view, but here's why it makes sense to me to follow the the grain here -- apart from punning being misleading to users (both for the specific method, and the injected inconsistency hurting usability / interprebility of the entire function), since duck typing is already practice (not sure how interfaces will work), extending a function from another module without sticking to the established behavior shouldn't happen.
OK. Lets go with removing the export of find
then.
fixed in #37
http://pkg.julialang.org/?pkg=LibExpat&ver=nightly
Locally:
It doesn't seem like LibExpat should extend
Base.find
since it doesn't return and index and doesn't always return an array. Is there an alternative name that fits the domain? Or if keepingfind
is preferable, we could just always qualify it rather than exporting it.