fixnum icon indicating copy to clipboard operation
fixnum copied to clipboard

Make the native `Int64` class an extension type

Open osa1 opened this issue 2 years ago • 3 comments

In #117 we make Int64 class a wrapper around int on platforms that support 64-bit ints (VM, AOT, Wasm).

With extension classes we should also make the new wrapper class an extension class to eliminate the indirection to the actual int value.

This will be a breaking change as this new native Int64 extension class won't have a runtime type.

osa1 avatar Oct 18 '23 07:10 osa1

I don't think this will work as Int64 values are put in collections with objects of other types, e.g. the list of field values in a protobuf.

rakudrama avatar Oct 18 '23 23:10 rakudrama

My understanding is you can pass extension types as generic arguments just fine. If you have a List<Int64>, the runtime type will be List<int> on the platforms where Int64 is an extension type, List<Int64> on others.

osa1 avatar Oct 19 '23 06:10 osa1

My understanding is you can pass extension types as generic arguments just fine. If you have a List<Int64>, the runtime type will be List<int> on the platforms where Int64 is an extension type, List<Int64> on others.

This is true, but _FieldSet.values is a List<dynamic>.

rakudrama avatar Oct 20 '23 00:10 rakudrama