saying "linspace returns a vector" is a lot easier than explaining "linspace 
returns a special data type that sometimes acts like a vector, except for when 
you try to write to it, etc." since linspace is a basic function in numerical 
analysis, it would come up way before trying to introduce the notion of 
abstract types.

Sent from my iPad

> On 1 Oct 2015, at 11:03 PM, Steven G. Johnson <[email protected]> wrote:
> 
> 
> 
>> On Thursday, October 1, 2015 at 8:37:28 AM UTC-4, Sheehan Olver wrote:
>> 
>>         I think an argument for linspace returning an Array is that it makes 
>> teaching new programmers Julia a lot easier. 
>> 
>>  If it returns an Array, its sufficient to teach students the Array type.  
>> But if it returns a Range, one has to teach an extra data type before the 
>> students can use it. 
> 
> Why?   Why should students care about the type at all in order to use the 
> result?  At the beginning level, you normally wouldn't declare argument types 
> to functions at all, e.g. f(x) = ....   At a more advanced level, where you 
> are using multiple dispatch, they should really learn to use abstract types 
> like AbstractVector for declaring arguments, so that their functions are 
> type-generic.   Dispatching on Array (rather than AbstractArray) is usually a 
> mistake, and it's better not to learn bad habits early.

Reply via email to