INim icon indicating copy to clipboard operation
INim copied to clipboard

WIP: First attempt at integrating HCL

Open Tangdongle opened this issue 4 years ago • 4 comments

WIP

Tangdongle avatar Jun 08 '20 11:06 Tangdongle

Had a crack at this, got segfaults on start:

... # This goes on for a while above, essentially points the finger at noiser
register global: /home/ryan/.cache/nim/inim_d/lib@[email protected] sessionNoAutoIndent__O0k9bD9cizXOF7Novj1bn1Qg
  register global: /home/ryan/.cache/nim/inim_d/lib@[email protected] buffer__pa9cnc9c8OYdSwAdothj57Bw
  register global: /home/ryan/.cache/nim/inim_d/lib@[email protected] noiser__DGuy2uWscYvZbDnH37g85w
Traceback (most recent call last)
/home/ryan/.choosenim/toolchains/nim-#devel/lib/nimhcr.nim(528) hcrInit
/home/ryan/.choosenim/toolchains/nim-#devel/lib/nimhcr.nim(509) initModules
/home/ryan/.choosenim/toolchains/nim-#devel/lib/nimhcr.nim(465) initGlobalScope
/home/ryan/dev/INim/src/inimpkg/logic.nim(70) logic
/home/ryan/dev/nim/nim-noise/noise.nim(73) init
/home/ryan/dev/nim/nim-noise/noise/basic.nim(113) isUnsupportedTerm
/home/ryan/.choosenim/toolchains/nim-#devel/lib/pure/includes/osenv.nim(131) getEnv
/home/ryan/.choosenim/toolchains/nim-#devel/lib/pure/includes/osenv.nim(103) findEnvVar
/home/ryan/.choosenim/toolchains/nim-#devel/lib/pure/includes/osenv.nim(97) getEnvVarsC
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Looks like an issue initializing Noise when getting env vars on the terminal. Might not have access or something. Running on #devel nim c --app:lib -d:traceHcr ~/.choosenim/toolchains/nim-\#devel/lib/nimhcr.nim nim c --app:lib ~/.choosenim/toolchains/nim-\#devel/lib/nimrtl.nim export LD_LIBRARY_PATH=/home/ryan/.choosenim/toolchains/nim-#devel/lib/ to set up the HCL libraries, then running nim develop to execute the task in config.nims (which I've defined in this branch: https://github.com/inim-repl/INim/pull/87)

Tangdongle avatar Jun 08 '20 11:06 Tangdongle

I'd love to get @timotheecour's eyes on this. This looks tricky!

0atman avatar Jun 08 '20 15:06 0atman

there are some basic HCR bugs (eg https://github.com/nim-lang/Nim/issues/13999 although IIRC that was osx bug only); can you minimize (remove all dependencies) to isolate what the bug is?

timotheecour avatar Jun 08 '20 21:06 timotheecour

Ok, stripped it down so that it worked and I could hotcode reload basic stuff. I hit two issues

### Current Config File ###
[History]
persistent=True
[Style]
prompt="nim> "
showTypes=True
ShowColor=True
showColor=True
[Features]
withTools=False

Getting section: Features and key: withTools
Traceback (most recent call last)
/home/ryan/dev/INim/src/inim.nim(119) inim
/home/ryan/dev/INim/src/inim.nim(59) main
/home/ryan/dev/INim/src/inim.nim(12) getOrSetSectionKeyValue
/home/ryan/.choosenim/toolchains/nim-1.2.6/lib/pure/parsecfg.nim(565) getSectionValue
/home/ryan/.choosenim/toolchains/nim-1.2.6/lib/pure/collections/tables.nim(1869) hasKey
/home/ryan/.choosenim/toolchains/nim-1.2.6/lib/pure/collections/tables.nim(1376) hasKey
/home/ryan/.choosenim/toolchains/nim-1.2.6/lib/pure/collections/hashcommon.nim(49) rawGet
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

And with getEnv

Getting editor
Traceback (most recent call last)
/home/ryan/dev/INim/src/inim.nim(119) inim
/home/ryan/dev/INim/src/inim.nim(57) main
/home/ryan/.choosenim/toolchains/nim-1.2.6/lib/pure/includes/osenv.nim(131) getEnv
/home/ryan/.choosenim/toolchains/nim-1.2.6/lib/pure/includes/osenv.nim(103) findEnvVar
/home/ryan/.choosenim/toolchains/nim-1.2.6/lib/pure/includes/osenv.nim(97) getEnvVarsC
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

This was run using devel and also 1.2.6 with the same results. @timotheecour Are you aware of any issues with hcr and these areas?

Tangdongle avatar Aug 20 '20 03:08 Tangdongle