Since this appears to be the “what design decisions do you consider questionable”-thread, I’d guess we all list what we are unhappy with (no need to extensively reply / justify, I don’t want to start a flame war; some might be matters of taste, some might just be me being stupid, some might actually be valid points)
Target audience:
PHP was originally designed explicitly for non-programmers (and, reading between the lines, non-programs); …
Typing:
It feels like julia can’t make up it’s mind about strictness of typing. Example: It is not entirely obvious what container type functions like collect or map will choose to use; or, in other words, the array type is viewed as a performance optimization, not a semantic distinction that needs to be always predictable to the programmer. This is reflected by isequal ignoring the array type. On the other hand, performant code often needs the programmer to know a lot about the types at hand. This is a conflict, of whether people want to quickly hack out some code that does something (charitable: python-style; uncharitably: PHP-style) and people who view julia as a more productive way of writing low-level code.
I often wished julia was stricter about typing. I wished isequal would consider types, such that “Any[1]!= Int[1]”. I wished UInt8(1) != Float32(1)
. I wished zero(AbstractFloat)
was an error, such that the following code throws on inhomogenous arrays instead of producing unpredictable results depending on how map / inference decided to create the outer array:
function ms(V)
s = zero(eltype(V))
for v in V
s+=v
end
s
end
A=AbstractFloat[Float32(0.1), Float32(0.3)]
B=Float32[0.1,0.3]
A==B
#true
ms(A)==ms(B)
#false
The problem here is that zero(Number)
is not a neutral element under addition modulo ===
(I think it is neutral modulo isequal
) and addition is not well-defined modulo isequal
. Hence the result of ms(collect(some_iterator))
depends more or less on the epistemic state of the compiler about the output of some_iterator
(as far as I understood).
Feature request: recursive type-checking variant of isequal (e.g. isequal_typed
as a recursive version of typeof(x)==typeof(y) && isequal(x,y)
). Currently type-checked equality is not just not the default, it is not provided.
Possibly a command-line flag for stricter typing rules; I think there is an ideal of well-typed code that base and most packages should strive for. A command-line flag could make all unclear things errors; this could be used for testing and development (and maybe in production for non-throwaway code).
On the other hand, sometimes I want to use julia as a scripting language (python-like dev-speed, python-like run-speed; but no language barrier to cross when calling into “good” julia code). In these cases I am incredibly thankful for julia “just doing something”. This is uncomfortably close to the linked
PHP is built to keep chugging along at all costs. When faced with either doing something nonsensical or aborting with an error, it will do something nonsensical.
The variant of using command-line flags for stricter typing rules smells of terrible kludges like “use strict”.
Sorry for the wall of text without really constructive criticism; language design is hard and full of trade-offs, and I am in total quite happy about julia.