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.