B3, default values, and implicit initialization
Quân Anh Mai
anhmdq at gmail.com
Fri Apr 21 11:06:33 UTC 2023
> As I mentioned yesterday, the high-order bit here is how we describe a
class whose (null-restricted) instances can tolerate (and possibly even
encourage) uninitialized use, just as the primitives do today.
I think a good starting position would be to consider the way C++ call
them, which is "trivially default constructible", referring to a class with
a zero-argument constructor which performs no action [1]. This name seems
to fit quite well because:
1, It is tied to the action of construction, which immediately signifies
aspects of behaviours it concerns with.
2, It helps the author of the class to make a decision whether the no-op
constructor is a sensible one (a constructor that does not initialize
anything).
3, It helps the users of the class to know whether a class can be
constructed without explicitly invoking a constructor (that is the default
value can be trivially obtainable).
Thanks,
Quan Anh
[1]:
https://en.cppreference.com/w/cpp/language/default_constructor#:~:text=A%20trivial%20default%20constructor%20is,)%20are%20trivially%20default%2Dconstructible
.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-spec-comments/attachments/20230421/b4af724a/attachment-0001.htm>
More information about the valhalla-spec-comments
mailing list