I would expect arrays to behave consistently regardless of whether they are emitted or written in F#
[<Emit(" [1] ")>]
let arr : int [] = jsNative
[|1|] = [|1|] // is true
arr = [|1|] // is false
I'd expect both to have the same result. JS semantics would result in false whereas F# semantics would make both true. I would suggest the latter
using docker image: nojaf/fable:latest
F# use TypedArray when possible to improve performance.
open Fable.Core
open Fable.Core.JsInterop
open Fable.Import
[<Emit(" [1] ")>]
let arr () : int [] = jsNative
JS.console.log([|1|] = [|1|]) // is true
JS.console.log(arr () = [|1|]) // is false
Generated JS:
import { equals } from "fable-core/Util";
console.log(equals(new Int32Array([1]), new Int32Array([1])));
console.log(equals([1], new Int32Array([1])));
@alfonsogarciacaro Daaamn repl2 is already working? and with elmish samples too, talk about next level fancy stuff, this is amazing :heart:
@Zaid-Ajaj Sshh, it's a secret :wink: Yes, repl2 is working and it features several of your Elmish samples. It'll be announced shortly :+1: Glad you like it!
@alfonsogarciacaro Only here to tell you that the repl is indeed awesome! (just one minor nit I noticed while using no-script blocking nupkg.com: The error reporting could be a bit better)
@matthid Sorry, do you mean when JS is disabled in the browser? How would you show the error in that case, with an HTML tag? Could you please send a PR for that?
Seems like I cannot reproduce anymore but I had this configuration:

and the samples stayed blank. You probably can ignore me as noscript is really uncommon nowadays. Anyway it seems blocking the script no longer works and my browser/the extension is not doing what I want. So now it always works...
when I closed and the page refreshed I could see the discussion had continued. With the Int32Array comment I find the behavior to be consistent. I emitted a different type of object than what I should have expected fable to compile to. However since you continued the discussion. I'd leave it up to you whether it should be closed
Thanks for confirming @runefs. Ok, let's close this and continue the discussion if necessary in the repl2 repo :)
Most helpful comment
@Zaid-Ajaj Sshh, it's a secret :wink: Yes, repl2 is working and it features several of your Elmish samples. It'll be announced shortly :+1: Glad you like it!