-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
needs decisionA decision on this change is neededA decision on this change is needed
Description
The usual convention in Julia is that the constructor has the same name as the type, e.g. we construct an Array with Array(...) etcetera.
However, some of the bits types don't follow this rule: the constructor for Int is int(...), the constructor for Float64 is float64(...), etcetera. This is inconsistent, annoying, and confusing.
It is especially annoying because it means that a typealias for one of those types also does not have a constructor, e.g. there is no constructor for Cint. Of course, one could define cint(...) but that is annoying (not to mention polluting the namespace).
Right now, trying to define constructors named Float32 etcetera fails:
julia> import Core.Float32
julia> Float32(x) = float32(x)
ERROR: invalid method definition: not a generic function
I'm not sure if there is any deep technical reason for this limitation?
Metadata
Metadata
Assignees
Labels
needs decisionA decision on this change is neededA decision on this change is needed