On Wednesday, January 14, 2015 at 11:34:55 AM UTC+10, Petr Krysl wrote:
>
> By the way: what is wrong with having 
>
> length(Boat)
> length(Vacation)
> length(Membership)
> length(Stay)
> length(Nose)
>

Hi Peter,

This makes sense because length() is generally a single concept, but for 
example bark() is a very different concept when applied to trees compared 
to when applied to dogs.

Currently there is nothing in Julia to indicate when a generic function 
(which has only a name like bark) refers to the same concept.  So the 
compiler can't be told when it is intended that two generic functions 
defined in different modules refer to the same concept and so the methods 
are intended to be combined.  You have to define the methods on the same 
generic function to combine them, eg Base.length() or the method Milan 
proposed.

Choosing a default (combining and dropping method clashes, combining and 
erroring method clashes, not combining and dropping both functions, other) 
is never going to be "correct" in all cases.  The best the Julia devs can 
do is choose a default which causes module users minimal risk and ensures 
everybody else is equally unhappy, until it becomes possible to specify 
combine or not.

Cheers
Lex
 

>
> ? I think the answer is NOTHING. So why should length() take on a definite 
> (and fixed) meaning in the Base module?
> Julia already SUPPORTS this, so why limit this when it could be a good 
> thing?
>
> P
>
>>
>>>

Reply via email to