On Wednesday, March 18, 2015 at 10:33:17 PM UTC+1, Mauro wrote: > > > I'd be interested to know a case where confusion could arise. > > I remember that I got confused by a python library using the bit-shift > operator >> for writing to files (C++ style). Got me confused for sure. > > I think it makes sense that typing, say, ?map should give you a help > text which applies to all methods of Base.map. Without having to look > into help for specific methods. > > You have a point there. I suppose I will rename this function, then.
Yet there are many base function with short names, it might not always be easy to circumvent these (although Julia helps by issuing an import warning if the function is overloaded). As discussed here <https://github.com/JuliaStats/Clustering.jl/pull/32> it is considered confusing to use `min' as a variable and overload `minimum', even though they have the corresponding semantics. > ---david > > > > On Monday, March 16, 2015 at 4:15:22 PM UTC+1, Patrick O'Leary wrote: > >> > >> On Monday, March 16, 2015 at 10:09:40 AM UTC-5, David van Leeuwen > wrote: > >>> > >>> Related to this question: what if you want to use the name of a base > >>> function for your type, where the meaning is _not_ related, but there > is no > >>> sensible function that would have that meaning for your type? > >>> > >>> E.g., in GaussianMixtures, I used `map(::GMM, ...)` for > >>> maximum-a-posteriori adaptation of the GMM. I can't see ::GMM in the > role > >>> of a ::Function, so I personally do not mind this re-use of an > existing > >>> function name from Base. Others may disagree wholeheartedly. > >>> > >>> ---david > >>> > >> > >> Don't `import Base.map`, and leave `map` off of your exports list. This > >> means users have to use the fully-qualified `GuassianMixtures.map`, but > >> there is no risk of confusion. > >> > >> (Though I am not sure that I would read "map" as a shorthand for > "maximum > >> a posteriori"--"maxpost", maybe?) > >> > >> Patrick > >> > >
