Re: javascript new object
>From the >[manual](https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma) > : proc cppMethod(this: CppObj, a, b, c: cint) {.importcpp: "#.CppMethod(@)".} Produces: x->CppMethod(1, 2, 3) As a special rule to keep backwards compatibility with older versions of the importcpp pragma, if there is no special pattern character (any of # ' @) at all, C++'s dot or arrow notation is assumed, so the above example can also be written as: proc cppMethod(this: CppObj, a, b, c: cint) {.importcpp: "CppMethod".} The same thing is happening in your snippet. Try using `importcpp: THREE.BoxGeometry(@)` PS: I think you don't really need `jsnew`, you can just do `importcpp: "new THREE.BoxGeometry(@)"`
Re: shorthand for literal type annotations?
@Ar : if you are on devel, you can use [mapLiterals](https://github.com/nim-lang/Nim/blob/devel/lib/pure/collections/sequtils.nim#L721) from sequtils import sequtils let x = mapLiterals([0.1, 1.2, 2.3, 3.4], int) doAssert x is array[4, int]
Re: Nim Dogfooding
> **miran**: 3. How do I share a link to a specific comment in the thread? There's a PR open for this [#114](https://github.com/nim-lang/nimforum/pull/114) Anyway,the forum is fairly useable, only thing I miss is notifications for replies.
Re: Long story short.
Hi, welcome to Nim community! You may consider adding your company to [Companies Using Nim](https://github.com/nim-lang/Nim/wiki/Companies-using-Nim) if you end up using nim in production. All contributions to nim ecosystem are welcome! Feel free to drop by on irc (or [gitter](https://gitter.im/nim-lang/Nim)) if you have any questions.
Re: How does a
I got it to compile, but it fails a Runtime when unpacking an Option. The problem you have (I think) is that the hash proc is not exported from `typerekjister.nim`, so it's not visible from `kueues.nim` and your tables implementation can't find it. The changes I made: `typerekjist.nim`: export hash, id # export from tekst and rekjster `tekst.nim` (note the export markers, I'm not sure why these where needed): type SharedText* = object txt*: cstring txthash*: Hash txtlen*: int Now it fails (at runtime) with: TESTING message queues ... kueues.nim(348) receiver kueues.nim(259) idOfType typerekjister.nim(107) get options.nim(103) get Error: unhandled exception: Can't obtain a value from a `none` [UnpackError:ObjectType] Error: execution of an external program failed: 'C:\Users\stisa\OneDrive\Progetti\nimtemp\kueues.exe ' compiling with `nim c -r --threads:on kueues.nim` on a Windows 10 x64, using gcc.
Re: Can I somehow show context-specific information in an {.error.} ?
Mmh there is an error proc in macros that I _think_ does that: [https://nim-lang.org/docs/macros.html#error,string,NimNode](https://nim-lang.org/docs/macros.html#error,string,NimNode)
Re: Can I somehow show context-specific information in an {.error.} ?
You can use asserts: let b: byte = 42'u8 let c = 42'u16 proc test*[T](t: T): bool = assert(sizeof(T) == 1, "invalid parameter size: " & $sizeof(T)) result = true echo test(b) echo test(c)
Re: Why isn't this concept working as I would expect?
Uh strange, I tried it here [https://glot.io/snippets/ev7buwzukn](https://glot.io/snippets/ev7buwzukn) and it worked fine, it's probably a regression.
Re: Why isn't this concept working as I would expect?
This works for me: type ConceptA = concept c ConceptB = concept c c.myProc(ConceptA) Obj = object proc myProc(obj: Obj, x: ConceptA) = discard echo Obj is ConceptB #true As for why, I'm not really sure as I haven't really used concepts, but I think you are supposed to describe procs with the types they expect, not as if they were declarations.
Re: I enjoy seeing the nimble package updates
Check out [https://nimble.directory](https://nimble.directory)/ too, there's a `New packages` section
Re: Cannot get name of type using typedesc
@LeuGim sorry to hear that, I'll try to fix it later today. I'm not a webdev, so I was under the impression that the `Access-Control...` part was to be done server-side. As for the `innerText` bit, you are right, Firefox only added it in 45. I'll try using `textContent` instead, which should be good for IE9+. Other common suggestions seem to be: * some indicator that it's doing something * work in preview And maybe a button to go to `play.nim-lang.org`? (Sorry for going OT, if you have more suggestions consider raising an issue in nimforum repo)
Re: project organization question
You can also use nimscript to create the dir ( eg `mkdir "tests"`), or do some nice things like build all tests in a dir, eg import ospaths task tests, "Runs tests": withdir "tests": for file in listfiles("."): if splitfile(file).ext == ".nim": exec "nim c -r --verbosity:0 --hints:off " & file
Re: Formatted Backend Output?
Besides embedsrc, see also [https://nim-lang.org/docs/nimc.html#compiler-usage-command-line-switches](https://nim-lang.org/docs/nimc.html#compiler-usage-command-line-switches) . The``genMapping`` option may be useful too. I'm not sure this is what you are asking, but if you want to know how the code generator actually produces the target code, my suggestion is to read `compiler/jsgen.nim` first, which is the js code generator and is a lot simpler than the c/c++ one (which is divided in various files, the actual pass is in `compiler/cgen.nim` if I remeber rigth)
Re: Python-like with, context managers, and the RAII pattern
`with` is a keyword, so you can't use that. You could use something like this maybe? import macros macro take(args,body:untyped):untyped = result = newstmtlist() result.add(newvarstmt(args[^1],args[1])) for st in body: result.add(st) take 3 as f: echo f (I haven't really used macros a lot, there's probably a better way to copy the nodes from `body`)
Re: Code substitution with templates
You can also mark the whole template with `{.dirty.}` template someCode(): untyped {.dirty.}= var fname: string = "Mark" age: int = 44 someCode() echo fname # "Mark" echo age # 44 Notice both symbols are visible outside the template. See also [https://nim-lang.org/docs/manual.html#templates-hygiene-in-templates](https://nim-lang.org/docs/manual.html#templates-hygiene-in-templates)
Re: parsecsv problem
With [existsFile](https://nim-lang.org/docs/os.html#existsFile,string) you could do something like import os let filename = "my.png" if not existsFile(filename): raise newException(IOError, (filename & " not found"))
Re: Nim newbie request/challenge
Sounds interesting, I might try doing a direct port from cpp to nim when I get some free time. Btw, download is indeed behind a paywall (looks like scribd offers a month free but after that it's paid). Reading is free though. Copy pasting from the pdf is impossible, as latex or whatever mangles the symbols, but I found a gist [here](https://gist.github.com/jzakiya/2410458be9c79b2f1c9a) Also found this link in the references [https://www.4shared.com/dir/TcMrUvTB/sharing.html](https://www.4shared.com/dir/TcMrUvTB/sharing.html) but it won't let me download anything. I'd suggest setting up a [github pages](https://pages.github.com/) website with an html version (pandoc or similar can convert most formats to html) or at least some kind of git repo with the code, as it's free and most people here are used to cloning things to look at them on their pc (at least I am).
Re: Thoughts on imports
For 1, if the condition is available at compile time (generally this means `abc` and `def` are `const`) you can use a `when` block to import the module, eg: when cond: import foo # this is only imported if `cond` is true and evaluable at compile time if cond: foo.bar() I don't think importing a module at runtime is possible at all. For 2, you can use `from math import nil` to force fully qualified names ( see [here](https://nim-lang.org/docs/manual.html#modules-from-import-statement) )
Re: "Warning: Cannot prove that 'result' is initialized"
You can avoid the warning by having the enum start at 0: type MouseButton* = enum mbNone mbLeft = 1 mbMiddle = 2 mbRight = 3 Since enum default to the value 0, and your enum starts at 1, the default value of your enum is invalid: type MouseButton* = enum mbLeft = 1 mbMiddle = 2 var ml : MouseButton echo ml #> 0 (invalid data!) Actually, I think that you can make it start from whatever value you want, eg. -23, as long as your enum contains a value for 0, but I haven't tested it. (note that even if you start from a negative number, the default value of the enum is the one that corresponds to 0, not the first one in the list)
Re: The Nim Language Manual
@oyster : the source is [text files](https://github.com/nim-lang/Nim/tree/devel/doc/manual) (they are actually rst) which you can convert to pdf with `koch pdf`, it does rst->latex->pdf If you want a prebuilt version, I built the pdf some time ago: [here](https://github.com/stisa/misc/raw/master/nim-pdfs/manual.pdf) . It should be mostly up to date, as it was built from devel near the release of 0.17.
Re: Can concepts/generics do type tags without affecting binary representation of the type?
This is the closest thing I can think of: import macros macro dotAccess(o: typed, str: static[string]): untyped = # Macro to do `o.str`, probably not the best way newDotExpr(o,newIdentNode(str)) type DataTable = concept x x is tuple|object for f in fields(x): f is seq # your example had `x` here, wich didn't really make sense to me, # as if x is tuple or object it can't be seq, no? OrderedDataTable[key: static[string]] = concept od od is DataTable od.dotAccess(key) is seq # Checks that `od` has field `key` od.k == key # check the key of the concept matches the key of the object MyDt[k:static[string]] = object a: seq[int] b: seq[float] var ob: MyDt["a"] echo ob is DataTable # true echo ob is OrderedDataTable["b"] # false echo ob is OrderedDataTable["a"] # true I don't really know how you would access `key` if it wasn't stored in the object type. ( looking at the generated C, looks like `MyDt` is a struct with fields `a` and `b`, so it should be the same binary representation? I think I remember reading that generics exists only for the nim compiler, they do not affect the C code)
Re: Checking in macro if proc has side effects or not
Something like this? import macros proc clean(a, b: int) : int = result = 2 * a + b proc dirty(a,b:int): int = echo "dirty" 3 macro hasNoSideEffects(p : typed) : untyped = result = newCall("compiles", newNimNode(nnkProcDef)) let frm = p.symbol.getImpl var i = 0 # frm has an additional result node at the end, this ugly loop # is to construct our procDef without altering the original proc. while i < frm.len-1: if i == frm.len-1: break result[1].add(frm[i]) inc i addPragma(result[1], newIdentNode("noSideEffect")) echo hasNoSideEffects(clean) # true echo hasNoSideEffects(dirty) # false As NimNodes are `ref` types, I don't think you should change the ones returned from getImpl directly ( I may be wrong though ). ( There are probably better ways to get all childs except the last, but I can't seem to find them. ) When dealing with macros, it's usually useful to compare the ast you generate with the ast printed by `dumpTree`, eg: import macros dumpTree: proc clean(a, b: int) : int {.noSideEffect.} = result = 2 * a + b
Re: New website released!
@andrea: for packages sites, there are also [http://nimism.co](http://nimism.co)/ and [https://nimble.directory](https://nimble.directory)/ , it would make sense to ask their devs to merge into a single project. Docker is mentioned under unix for some reason [https://nim-lang.org/install_unix.html](https://nim-lang.org/install_unix.html)
Re: New website released!
I like the new website, it's definitely an improvement over the old one, especially on mobile. Also, did you know that [https://nim-lang.org/blog.html](https://nim-lang.org/blog.html) leads to the new blog, while [https://nim-lang.org/blog](https://nim-lang.org/blog) leads to araq's musings? ps: dom96 : I think [https://nim-lang.org/faq.html](https://nim-lang.org/faq.html) is missing some link tags (editor support section)
Re: Need a push on investigation of compiler issue
I don't know if it's a compiler bug or not, the manual says `The [] subscript operator for arrays/openarrays/sequences can be overloaded.` but eg in macros and I think tables it's used. Anyway, for me on `git hash: b7bffa35c70eb1a55fe9e35307ba4e99e48abe69` * Tuple and object versions with subscript operator both don't work * Object version with call syntax doesn't work * Tuple version with call syntax works. echo x["p2"] # subscript operator echo `[]`(x, "p2") # call syntax For debugging the compiler, have a look at [this](https://github.com/nim-lang/Nim/wiki/Debugging-the-compiler) . Mostly you have to build a debug compiler ( `koch temp` ) and then use this version (normally it's `nim_temp` in your nim/bin folder) to run your test. Eg. traceback with `nim_temp c -r test.nim` Traceback (most recent call last) nim.nim(121) nim nim.nim(77) handleCmdLine main.nim(163)mainCommand main.nim(74) commandCompileToC modules.nim(240) compileProject modules.nim(180) compileModule passes.nim(215) processModule passes.nim(135) processTopLevelStmt sem.nim(536) myProcess sem.nim(508) semStmtAndGenerateGenerics semstmts.nim(1679) semStmt semexprs.nim(828)semExprNoType semexprs.nim(2268) semExpr semexprs.nim(1905) semMagic semexprs.nim(811)semDirectOp semexprs.nim(649)semOverloadedCallAnalyseEffects semcall.nim(388) semOverloadedCall semcall.nim(211) resolveOverloads semcall.nim(91) pickBestCandidate sigmatch.nim(2044) matches sigmatch.nim(2001) matchesAux sigmatch.nim(1836) prepareOperand semexprs.nim(26) semOperand semexprs.nim(2294) semExpr semexprs.nim(1315) semArrayAccess semexprs.nim(1280) semSubscript msgs.nim(1030) localError msgs.nim(1018) liMessage msgs.nim(872)handleError msgs.nim(857)quit
Re: R extensions and Nim
Just guessing, never tried anything like it, but you could try pre generating the sources for the platforms you want with something like [cross compiling](https://nim-lang.org/docs/nimc.html#cross-compilation) and then detect the one to compile with R? It would be similar to how Nim does bootstrapping with csources.
Re: Help in compiling nim on android termux
@NastyRigger: that's what `-d:android` does: [https://github.com/nim-lang/Nim/blob/c480505797f9d82b9b19a72b5a5abde9c0cb0fd4/lib/posix/posix.nim#L2426](https://github.com/nim-lang/Nim/blob/c480505797f9d82b9b19a72b5a5abde9c0cb0fd4/lib/posix/posix.nim#L2426) @cheatfate : thanks for the pointer, I'll have a look, I think it's a bit outside of what I can understand though
Re: Help in compiling nim on android termux
@amedeo : try compiling koch with `nim c -d:android koch` , if it works you can add `define:android` to `config/nim.cfg` so you won't need to define it every time you compile something.
Re: Help in compiling nim on android termux
@NastyRigger : This is just a guess, and I can't test it, but you could try changing `sigtimedwait` into `__rt_sigtimedwait` . Looks like `sigtimedwait` is present in `signal.h` starting from android api 23. @Araq : I could try making a PR, I'm guessing the part in `nim.cfg` should go in a `@if android` block? The problem is, on my phone defining `android` leads to an error ( which I think is the inverse of the above, that stems from `posix.nim` ), so I would have to define both `android` and `android6` (which is api23) and then in posix.nim `when not defined android6 and defined android`. I guess I'd also need to modify the generation of csources? How does that sound?
Re: Help in compiling nim on android termux
Just removed termux and reinstalled from scratch ( I can only test on my phone, android 7 ), here are my steps: apt install git apt install clang git clone https://github.com/nim-lang/Nim cd Nim && git clone https://github.com/nim-lang/csources apt install libandroid-glob && apt install libandroid-glob-dev In `csources/build.sh`` line 32: ``LINK_FLAGS="-landroid-glob ${LDFLAGS:-} "` In whatever `c#_#` ( mine was `c2_2` ) folder it's building, `stdlib_osproc.c` `"bin/sh"` -> `"sh"` (line 400) now in `csources`, `sh ./build.sh` should work. We have nim! In `config/nim.cfg` add `passL=" -landroid-glob "` and `define:termux` In `lib/posix/posix.nim` : line 283: `when defined(macosx) or defined(termux):` and on line 1623: `when not defined(macosx) and not defined(termux)` ( you just need to add the termux part ) In `lib/pure/osproc.nim` `"bin/sh"` -> `"sh"` (line 744 in nim) Now `./bin/nim c Koch` should work ./koch boot ./koch tools Hope this helps. ( I'll update my post if this works for you too )
Re: REPL?
The repl is hidden in `nim secret`, I think because it's not really stable.
Re: ospaths and NimScript
Most of them are in [os](https://nim-lang.org/docs/os.html)
Re: Function v. Writing operations
Looking at the docs [here](https://nim-lang.org/docs/system.html#14) , `..` is an alias for `countup`. btw, this for i in ..10: echo i works.
Re: var param vs tuple as return value
There's an irc channel here [http://webchat.freenode.net/?channels=nim](http://webchat.freenode.net/?channels=nim) , which is bridged to gitter, so you don't have to sign up. It's also logged, so you can read past conversations ( logs go back to about june 2012 I think ? ) [http://irclogs.nim-lang.org](http://irclogs.nim-lang.org)
Re: Shift operation for array elements
@jlp765 : yeah probably, and stefan said that, but I find this interesting :) So, based on [this thread](http://forum.nim-lang.org///forum.nim-lang.org/t/1471/2) , using reset on the elements we move out of the array should handle ref etc. properly. The code becomes this: proc shift[T](a: var openarray[T]; d: int) = if d == 0: discard # do nothing elif abs(d) >= a.len: # reset all for el in a.mitems: el.reset elif d > 0: # right shift moveMem(addr a[d], addr a[0], (a.len - d)*sizeof(T)) for j in 0..https://gist.github.com/stisa/3b32af4e2a1306c5f9a3c55731d6a6dd) on a win10 notebook with a quadcore i7 I get: CPU time: original 4.11s Delta occupied mem: original -483328 CPU time: first stisa 4.736s Delta occupied mem: first stisa -479232 CPU time: possibly leaking 0.04804s Delta occupied mem: possibly leaking -475136 CPU time: last stisa 2.263s Delta occupied mem: last stisa -479232 Note that `last stisa` gets closer to `possibly leaking` the closer to the edges we shift, while `original` and `first stisa` gets slower: shift(1): CPU time: original 23.209s Delta occupied mem: original -483328 CPU time: first stisa 23.261s Delta occupied mem: first stisa -479232 CPU time: possibly leaking 0.034000603s Delta occupied mem: possibly leaking -475136 CPU time: last stisa 0.046999704s Delta occupied mem: last stisa -479232 shift(5000): CPU time: original 3.831s Delta occupied mem: original -430080 CPU time: first stisa 4.416s Delta occupied mem: first stisa -479232 CPU time: possibly leaking 0.04849s Delta occupied mem: possibly leaking -475136 CPU time: last stisa 2.227s Delta occupied mem: last stisa -479232 I don't understand the gc enough to draw any conclusions,and it may very well be that what I wrote is flawed in ways I can't see, but the `possibly_leaking` seems to consistently free less memory than others. ps: compiling with `-d:release` brings down times considerably, eg shift(1) :`original` 2.5s ( `last_stisa` 0.035s) and shift(5000):`original` 0.8s ( `last_stisa` 0.38s) pps: is there a way to know how many times something is referenced? ( so I can tell how many calls to GC_unref() would be needed to cause the gc to collect it )
Re: Shift operation for array elements
@OderWat: do you mean something like this? proc shift[T](a: var openarray[T]; d: int) = if d == 0: discard # do nothing elif abs(d) >= a.len: # reset all zeroMem(addr a[0], a.len*sizeof(T)) elif d > 0: # right shift moveMem(addr a[d], addr a[0], (a.len - d)*sizeof(T)) zeroMem(addr a[0], d*sizeof(T)) elif d < 0: # left shift moveMem(addr a[0], addr a[-d], (a.len + d)*sizeof(T)) zeroMem(addr a[^(-d)], -d*sizeof(T)) But as Stefan said, I'm not sure how the gc sees this ( I think it's fine, as the total amount of memory doesn't change ( right? ) , we just change its value ) ps: what's a good way to benchmark this ( on windows ) ? Edit: thinking about it, I'm not sure what would happen to refs that get moved
Re: zeroMem can't use?
Nim has implicit initialization ( [http://nim-lang.org/docs/manual.html#statements-and-expressions-var-statement](http://forum.nim-lang.org///nim-lang.org/docs/manual.html#statements-and-expressions-var-statement) ) so: var x : array[10,char] echo repr x # ['\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'] Anyway, `alloc0` and the like return pointers, so you need to cast to `ptr array[]` : var inputs = cast[ptr array[10,int]](alloc0(sizeof(int) * 10)) inputs[0] = 1 inputs[1] = 2 inputs[2] = 3 for i in 0..9: echo inputs[i] echo repr inputs var test = alloc0(10) zeroMem(test, 10) echo repr cast[ptr array[10,char]](test) Produces 1 2 3 0 0 0 0 0 0 0 ref 0018F050 --> [1, 2, 3, 0, 0, 0, 0, 0, 0, 0] ref 00191050 --> ['\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'] Or just use create: var ar = create array[10,char] echo repr ar # ref 0092F050 --> ['\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'] Note that I don't think nim's garbage collector keeps track of pointers you get from `alloc` etc, so you may have to deallocate them yourself to avoid memory leaks
Re: Basic jupyter notebook kernel
Hi Peter, I knew the shadow variable looked too easy! Oh well... :) ( sorry if I keep asking obvious questions, I'm not used to handling memory and the like. I'll have to read up on how memory is handled by nim, the gc, etc ) So you have compile master> master runs block1, forwards its memory/variables/procs etc ( how? ), then exits > block1 waits for block2 and so on? Mmh I think there's still something I'm missing, as I don't see how you could preserve memory. I don't think just passing a pointer or something would be enough? Is there a way to avoid nim cleaning up memory when you close and executable? ( lol this sounds like intentionally leaking memory ) Unless you left all blocks running, all chained together? Maybe you could serialize variables with [marshal](http://forum.nim-lang.org///nim-lang.org/docs/marshal.html) , extending it to keep name and type, and having python hold the serialized data, but this could prove difficult if we ever need to handle large datasets. About assert, I was just asking as that is something we should document ( and maybe a magic of some kind could be added later on to disable -d:release ) Looks like you're right about Types, this works: type A = object x: string var a = A(x:"hi") echo a # (x: hi) block: var b = A(x:"hi") echo b # (x: hi) type A = object x: int var c :A = A(x:1) echo c # (x: 1) As a side note, this doesn't work: type A = object x: string var a = A(x:"hi") echo a #(x: hi) proc sum(x,y:A):A= result = A(x: x.x) block: var b = A(x:"hi") echo sum(a,b) # (x: hihi) type A = object x:string var c : A = A(x:"ho") var d : A = A(x:"ho") echo sum(c,d) #type mismatch But this is working as intended I guess, as A and block.A are different types as far as the type checker is concerned. Just something to keep in mind if we work with blocks. Another question: how would you handle a block being recompiled? For examples, current executing block is block5, user recompiles block1. Would the new block1 just be handled like if it was block6? ( I guess the answer is yes, as I can't think of any way this would break other things ) Thanks, Silvio ps: sorry, I didn't intend on this reply becoming so long
Re: Basic jupyter notebook kernel
@mora: Sounds like a good plan! I'm still relatively new to nim, so it's probably more detailed than anything I would have thought of. A couple of questions, sorry if they are obvious / make little sense: > The python wrapper will pass the code this binary, which will compile it, and > call it with dynlib. > The new code will not return, but it will compile the > next code, etc So something like like compile master > master compiles block1, runs block1 and adds its variables to master, then master waits for another block to be compiled ? > It would run with -d:release flag to get speed If I remember correctly, this would disable assert(...) right ? > I hope that I'll be able to create a compiler plugin Would this require recompiling the compiler or can those be added in a folder or something, maybe while installing (through pypi) ? > Each new block will have all the previously defined functions and types > prepasted before the block's code How do you plan to handle recompilation of a block that defines a type ? I guess you could omit types with the same name? > Secondly, if a function is not overloaded (e.g., if it is proc f(x: int):int, > then later there is no proc f(x: string):string), then instead of repeating > the > implementation in the new library, we can simply pass the function as a > parameter (I'm just only hope that this will work). Maybe you could convert procs to variables and then shadow them, like: proc f (x:string) = echo x Gets converted to var f = proc (x:string) = echo x f("hi") # hi And then you shadow them: f = proc (x:string) = echo "due" f("hi") # duehi Silvio
Re: Basic jupyter notebook kernel
@mora: Hi! No I've yet to make any progress, I got sidetracked a bit. Anyway, feel free to jump in, I'd really love to get a shared context working! Your solution would still be in python right? I _think_ your idea is what the original c kernel does, if you look in [resources/master.nim](https://github.com/stisa/jupyter-nim-kernel/blob/master/resources/master.nim) there is a ported version commented out, but as I don't understand how it should work the ported code is probably useless. >From what I can understand, it compiles a master as a dynlib that should then >execute the actual code the user writes. There is also a branch [here](https://github.com/stisa/jupyter-nim-kernel/tree/nim-based) , where I started work on a nim-only kernel, reimplementing messaging etc. but it is still in the early stages ( I think the heartbeat is working and little else ). Let me now if you make any progress!
Basic jupyter notebook kernel
Hi all, I got a basic kernel for jupyter notebook working, you can find it on [github](https://github.com/stisa/jupyter-nim-kernel) . It's based on [jupyter-c-kernel](https://github.com/brendan-rius/jupyter-c-kernel) ( actually, it's mostly the same ) and it uses the python implementation of the kernel machinery ( a pure nim version would be cool, but it's outside my abilites at the moment ). Still, from what I could test, it seems to work rather well as a scratchpad. Here is an example [notebook](https://github.com/stisa/jupyter-nim-kernel/blob/master/example-notebook.ipynb) . Please note that blocks of code don't share state ( for now at least ) as every block is treated as a different file/executable. I'll try to work on it when I have time (suggestions are welcome). Also, code completion is not currently implemented, I'll have a look at integrating nimsuggest.