Fable: typed arrays no longer have an Item member

Created on 4 Feb 2020  路  10Comments  路  Source: fable-compiler/Fable

I'm not sure when it got lost, but a long time ago it existed:

https://github.com/fable-compiler/Fable/commit/2d6dc560814e605de3cf5d11d70fd479ceffef9d#diff-f597394980f732e01c10b3a6a181fa74R584

Most helpful comment

In theory I released version 3.1.5 of Fable.Core with the fix in it

PS: I don't have (yet?) access to all the Fable nuget/npm so can't release fable-metadata for example etc. But I am trying to contact Alfonso to get the access in order to be able to release everything myself if needed.

All 10 comments

@0x53A ~Do you mind elaborating a bit, you probably mean something else than just this (which works)~:
(Array.item 2 [| 1; 2; 3 |]) = 3

I see, you mean IList.Item. I'll take a look.

@0x53A Yes, looks like the non-generic interfaces (System.Collections.IList and System.Collections.ICollection) are not implemented at the moment, that's easy to fix.
In the mean time until the fix gets in, you can use the generic interfaces:

open System.Collections.Generic
([| 1; 2; 3 |] :> IList<_>).Item 2 = 3
([| 1; 2; 3 |] :> ICollection<_>).Count = 3

Sorry for not being more specific.

I meant the indexer, this no longer works:

f# let arr : JS.UInt8Array = ... let b : byte = arr.[0]

@0x53A I'm not sure what the part behind the ellipsis is supposed to be, but this works as expected:

open Fable.Core
let arr = [| 1uy; 2uy; 3uy |]
let b: byte = arr.[0]

compiles to:

export const arr = new Uint8Array([1, 2, 3]);
export const b = arr[0];

Please clarify further if that's not what you mean.

@0x53A Nevermind, you're correct, looks like the indexer is not there in the TypedArray interface, so this is broken:

open Fable.Core
let arr = JS.Uint8Array.Create(5)
let b = arr.[0]

I'll take a look.

I just did a paket update and now have Fable.Core = 3.1.4

image

but Fable.Core.JS.Constructors is not available in the repl, so either the repl is old or there is something wrong in my project.

@0x53A I'll take a look.

@0x53A The REPL is indeed old last release of the REPL is September 2019.

I am taking a look at the different issues in Fable ecosystem, and trying to solve them etc. Will take a bit of time, but I am working on it :)

This was fixed but requires a new Fable.Core to be published.

In theory I released version 3.1.5 of Fable.Core with the fix in it

PS: I don't have (yet?) access to all the Fable nuget/npm so can't release fable-metadata for example etc. But I am trying to contact Alfonso to get the access in order to be able to release everything myself if needed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

et1975 picture et1975  路  3Comments

MangelMaxime picture MangelMaxime  路  3Comments

alfonsogarciacaro picture alfonsogarciacaro  路  3Comments

forki picture forki  路  3Comments

alfonsogarciacaro picture alfonsogarciacaro  路  3Comments