On Thu, Dec 03 2015, Eric Forgy <[email protected]> wrote:

> Regarding Glen's last sentence, this could be obtained, if desired, by 
> making Number <: AbstractArray. However, I can imagine the appetite for 
> doing that is approximately (and rightly so) zero. In my opinion, Numbers 
> are scalars and should not have a getindex or any related array operations 
> that Glen highlights are largely broken anyway. However, one of the 
>
> [...]
>
> This is motivated by strict mode 
> <https://msdn.microsoft.com/en-us/library/br230269%28v=vs.94%29.aspx>, i.e. 
> "use strict", in JavaScript. So now, in Julia, you can call:
>
> using strict
>
>
> This gets you a subset of Base that, for the moment, simply kills some of 
> the array operations on Numbers, but I hope to grow this by killing any 
> softer corners in Base where some compromises seem to be made.

Regarding the initial issue: not having atoms but mostly arrays and then
implementing scalars as single-element arrays potentially made sense for
languages that rely heavily on vectors and vectorizes syntax, like R and
Matlab. I think that Julia is much more Lisp-like, and encourages
iteration, so the distinction between atoms and vectors is useful. Not
having scalars would be a terrible design choice IMO, fortunately that
did not happen in Julia.

Now, allowing scalars to behave as vectors is a different thing. I am in
two minds about its usefulness, it seems like a nice DWIM extension, but
can be a potential source of bugs when it is ambiguous.

I guess only time and experience can tell what is better, reasonable
people can make good a priori arguments for either case.

Which is why I think that your strict.jl is great! It allows people to
experiment with removing this feature.

Best,

Tamas

Reply via email to