nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.55k stars 1.47k forks source link

json module cannot be imported in nimscript #19974

Closed geekrelief closed 1 year ago

geekrelief commented 2 years ago

https://nim-lang.github.io/Nim/nims.html says the json should be available to nimscript.

With --mm:orc enabled.

Example

test.nims:

import std / json

Run with: nim e test.nims

Current Output

C:\Nim\lib\pure\json.nim(465, 24) template/generic instantiation of `==` from here
C:\Nim\lib\system\comparisons.nim(298, 18) template/generic instantiation of `seqToPtr` from here
C:\Nim\lib\system\comparisons.nim(294, 25) Error: undeclared identifier: 'NimSeqV2'

Expected Output

No error.

Possible Solution

https://github.com/nim-lang/Nim/blob/7d0285853f4327a0a4f683e13971dc3429aad1f3/lib/system.nim#L1799-L1801 This prevents seqs_v2 from being included for nimscript.

Additional Information

Nim Compiler Version 1.7.1 [Windows: amd64]
Compiled at 2022-07-04
Copyright (c) 2006-2022 by Andreas Rumpf

git hash: d2d8f1342b3125aac8e0592da25df61e6feb95b2
active boot switches: -d:release
beef331 commented 2 years ago

Your min reproduction does not error so I can only assume you're attempting to compile the nimvm with orc or arc.

geekrelief commented 2 years ago

Yes, this is with orc.

ringabout commented 1 year ago
--mm:orc
import std/json

fixed by https://github.com/nim-lang/Nim/pull/21379 since now it parses the whole module.