On Wednesday, 30 September 2015 20:27:02 UTC+1, Matt Bauman wrote: > > There can be reasons where a special read-only `Ones` array type is > beneficial: http://stackoverflow.com/a/30968709/176071. It's just five > lines of code, and Julia/LLVM is able to optimize it such that > multiplication is totally elided. It's pretty cool. But as others said, > these functions are fairly well entrenched in creating mutable arrays. The > output from linspace, however, isn't typically mutated. > > Back to linspace, I'm still curious to hear more reasons for the strong > dislike. Is it because of how it behaves? Or how it performs? Or how > it's displayed (which is also valid)? >
I actually have no problem with an abstract Ones type or with the I that Steven mentioned. I simply dislike is that linspace does not behave as expected, and I expect that this is the main reason for other as well. To give an extreme analogy, we don't go around and start defining A * B = A + B either, and linspace and similar names are just so ingrained in the Matlab (and apparently also Python) community, that it trips us up when they suddenly behave differently. Finally, I don't buy the argument that linspace should be abstracted because of memory. It always creates one-dimensional grids, and those aren't the issue. There is a much stronger argument to create an abstraction for meshgrid and I even disliked that that one was dropped.
