-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rename uninitialized to undef #26316
Conversation
e8e55ba
to
487991b
Compare
🍿 |
This is the right direction. |
#TeamJunk |
What about |
Visually it is too similar to unit. One (me) might guess it is a variant of unit in some strange way... |
|
I like |
|
Not true for non-isbits type. |
"Undefined" unfortunately means a couple different things. In the case of isbits types, the values you get are undefined in a sense similar to "undefined behavior" --- you don't know what you're going to get. For non-isbits types, you know exactly what you're going to get --- null pointers that reliably throw UndefRefError when you access them. That's "undefined" in the sense of "not set yet". The |
We could use |
If the terminology is not standard, then perhaps change |
Matlab (file exchange) has an
|
Changing I think
|
|
|
|
I think |
Or |
|
What about Bonus point 1: We can use Bonus point 2: In the future someone might want more control over where and how to allocate. This way we have streamlined the names beforehand! |
How about |
I think undef, uninit, and noinit all express the concept reasonably well. |
My proposal is this:
This approach avoids having a thing ( |
|
I think we might as well provide a way to explicitly request uninitialized memory now --- it's very easy, since it's already implemented, and I'm not optimistic about making zero-initializing cost-free. |
I agree with Jeff. |
I've not weighed in here yet because I really don't find
|
I don't think that makes sense --- positional arguments can also have default values. If 0x0 is the right thing to return for I'm in favor of the keyword arguments, but I'm pretty sure we will also need a first-class way to request uninitialized data at some point, in some context. Deliberately adding a construct ( |
I think this is different because |
We're talking about |
Apart from some people (including myself) not liking the keyword syntax: Are we sure that keyword arguments are reliably fast and the type gets inferred reliably? (we need to infer the I mean, requesting some uninitialized memory for an array is pretty low-level and should give predictably good machine code. Looking at e.g. the first of the following does not fill me with confidence in the reliability of performant keyword args, today:
Also, I really like the first slot of the constructor as a singleton for giving metadata on initialization. This allows people to extend it by stuff like scrubbing their data on free,
or, occasionally useful for branch-free pushing (get a giant chunk of virtual memory that is materialized by the kernel on-demand, needs the finalizer hack in order to not play havoc with julia's memory accounting but then you can just write to the array and TLB/pagefault/kernel does the resizing for us)
|
Why would we use
Some optimizations can only be performed if you call it from a compiled context — e.g., use |
487991b
to
3d1d014
Compare
3d1d014
to
ee6203d
Compare
Changed from |
ee6203d
to
ef6a313
Compare
unknown, unsure |
|
Triage thinks we can go with |
Ok, will update PR with new |
070a9dd
to
e1efa94
Compare
I'm still uneasy with the similarity of |
How did a user find
Also clear it is not |
julia> Vector{Array}(undef, 1)
1-element Array{Array,1}:
#undef
julia> Ref{Array}()
Base.RefValue{Array}(#undef)
julia> Ref{Array}(undef)
ERROR: MethodError: Cannot `convert` an object of type UndefInitializer to an object of type Array This looks a little less confusing with |
Sure but the whole point here is that people hate to write |
* uninit is dead, long live undef * UnInitialized -> UndefInitializer + show method * also deprecate Uninitialized
uninitialized
is just so long...Edit: I changed my mind to like
undef
more... ALL VOTES ARE NOW INVALID MOHAHA ;)