Turning named functions into methods of a generic function is definitely
something Julia should take maximum advantage of. It does look like it
should work well in the case of 'factorize'. But I think it's a bit
unrelated from the naming convention issue. Most, if not the large
majority, of the standard library functions are not going to be neatly
separable into generic concepts.
On Tuesday, April 28, 2015 at 3:00:48 PM UTC-4, Glen H wrote:
>
> Having "using LinAlg" would help to clean up the namespace of available
> functions for people who don't need it but what I was proposing is doing
> "using LinAlg" shouldn't change the API that much (if at all). You still
> want to factorize numbers and polynomials (which are not part of LinAlg).
> The API shouldn't grow 10x because LinAlg adds a bunch of matrix types
> than can also be factorized. What I was proposing is actually a lot
> smaller list of fuctions to export (not more).
>
> For example
>
> Using multi-dispatch:
> factorize
> factorize!
>
> Not using multi-dispatch:
> factor
> factorize
> factorize!
> chol
> cholfact
> cholfact!
> lu
> lufact
> ldltfact
> qr
> qrfact
> qrfact!
> bkfact
> eigfact
> hessfact
> shurfact
> svdfact
> etc.
>
> (I don't tend to pick on LinAlg in general...it is just the example
> brought up by this thread. Please pick on the using multi-dispatch idea in
> general and not on specific errors/ommissions in the above list.)
>
> I found multi-dispatch to be annoying at first but came around to really
> like it. It made my code more generic, reduced the number of lines ("if"
> statements disappeared), ran faster, more modular, was more extendable and
> generic. I haven't used another programming language that gives such
> enjoyment...but if people don't adopt multi-dispatch then these benefits
> dissappear. The compound (shorthand) names will be shorter (horizontally)
> but the code will be less generic and you will have more lines to look at
> (vertically). There are no guidelines for these compound names to follow
> so it is confusing for everyone except the people who have memorized these
> names.
>