Open dcharkes opened 1 month ago
Its probably not possible to now change
Pointer
to an extension type.
Pointer
is a final class
so nothing can extend or implement itis Pointer<T>
already returns true
for all pointersruntimeType.toString()
would be "PointerNever"
instead of "Pointer<Never>"
but I don't think people should depend on that to begin with.So maybe this change won't be breaking afterall!
If you want to get your hands dirty, feel free to give it a spin in the Dart SDK! 😄
Now that we no longer reify the type arguments of
Pointer
we should consider whether
.cast()
can be replaced by simplyas
checks.Currently, the runtime still have a type arguments vector at runtime
So if we use a normal cast, we could accidentally introduce runtime type checks if the compiler can't figure out that pointers are always instantiated with
Never
as type argument.Conceptually speaking
Pointer<T>
should maybe be an extension type onPointerNever
(now that we stopped reifying the type argument). But, we've introducedPointer
s before extension types were added to Dart. Its probably not possible to now changePointer
to an extension type. 😄Thanks @HosseinYousefi for the suggestion!