yglukhov / nimx

GUI library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JS mode is completely broken since November

DiThi opened this issue · comments

JS mode is broken since commit 7cda4e1.

Steps to reproduce:

  • Create a hello world example.
  • Compile with nim js or in any official way.

Result with 7cda4e1:

[...]/nimx/nimx/assets/asset_loading.nim(41, 24) Error: type mismatch: got <array[0..0, string], openArray[string], proc (url: string, path: string, cache: AssetCache, handler: proc (){.closure, gcsafe.}){.closure, locks: <unknown>.}>
but expected one of:
[long output]

Result with head:

[...]/nimx/nimx/private/windows/js_canvas_window.nim(298, 27) Error: type mismatch: got 'proc (): Window{.locks: <unknown>.}' for 'proc (): Window = result = newJSWindowByFillingBrowserWindow()' but expected 'proc (): Window{.closure, gcsafe.}'
  Pragma mismatch: got '{..}', but expected '{.gcsafe.}'.

Result with head after adding {.gcsafe.} to that proc and init in js_canvas_window.nim:

[...]/nimx/nimx/formatted_text.nim(731, 25) Error: type mismatch: got <GraphicsContext, Rect, Point, FormattedText, proc (c: GraphicsContext, t: FormattedText, p: var Point, curLine: int, curAttrIndex: int, str: string){.locks: <unknown>.}>
but expected one of:
[VERY long output, very difficult to understand as it basically outputs a full proc source code twice as "expression"]

These changes to use .gcsafe. should probably have a condition for JS, or some way to tell the compile to ignore those altogether.

There's no difference with --threads:off and barely any change by using nim devel instead of stable.

Can confirm. On a fresh install of Nim 1.6.12, Windows 10, installed the package via nimble install nimx

Using the code available on the main page, compiling with nim js test.nim, it fails with the above error.

Yes, js support is no longer a goal since wasm is superior in all ways. Sorry this was not communicated earlier.