Re: Any chance there will be a wasm backend?
In case anyone thinks web assembly is interesting as a Nim backend or for playing around generally, they came out with a browser preview milestone today. [http://v8project.blogspot.com/2016/10/webassembly-browser-preview.html?m=1](http://forum.nim-lang.org///v8project.blogspot.com/2016/10/webassembly-browser-preview.html?m=1) So I believe I read that the binary format is basically stable now. Of course the simplest way to use Nim code is emscripten which now supports web assembly. They also have the S-expression wast2wasm tool and this [https://github.com/WebAssembly/binaryen/wiki/Compiling-to-WebAssembly-with-Binaryen#cfg-api](https://github.com/WebAssembly/binaryen/wiki/Compiling-to-WebAssembly-with-Binaryen#cfg-api) which to me actually the fun thing would be to go more directly from Nim to the bytes. Directly meaning skipping the external tools. Anyway, at least if someone is learning or something and wants to experiment with program compilation generally, if they happen to know about Nim and web assembly, they seem (to me) like an interesting target. Which I may play with it a bit in a non-serious way.
Re: Nim and Qt
Given that i'm the author of both nimqml and DOtherSide...mind to share the differences in your project in respect to nimqml?
typed values from c pointer
Hi, I am writing a nim wrapper for a c library and would like to construct a sequence of nim items from a generic proc. I can construct std library types with a call to a constructor like construct but this does not work for tuples or objects if i got this right proc get_item_from_pointer*[T](p: pointer, l_type : MyTypeEnum ; item : var T) = case l_type of MyTypeEnum.f32 : var typed_target = cast[ptr float32](p) item=T(typed_target[]) [...] The item construction works for int, float.. but not for custom enum types. In this example the l_type is the type of the c source pointer, item has the type I want to construct and f32 encodes float32 But I do need a "constructor" for a self defined tuple type which is not available by the type name - only by () Is there a way to construct a tuple or object based on the type information in a generic function like T() above? Maybe a way to identify tuple/object types? Kind Regards, b
Compilation breaks without showing an error
Just today I started writing my first lines of nim code (great language, I'm really excited so far). Of course I've made some mistakes in my first code parts, but one of these mistakes lead to the compiler terminating compilation without giving an error or any hint at all of what is going wrong. Though I'm not sure this is the right place to report this behavior, I thought better do it here then just ignore it. I had a test program, where I played around with concepts and in one of the concepts I had a typo ('x' instead of 't'). This was no problem so far until I made an import of the typetraits module. With this import "nim c main.nim" just terminates without generating any code and without reporting any error. Here is a minimal code snippet to reproduce the issue (Nim 0.15.2 Linux amd64): import typetraits # without this import the program compiles (and echoes false) type SomeTestConcept = concept t x.name is string # typo: t.name was intended (which would result in echo true) type TestClass = ref object of RootObj name: string var test = TestClass(name: "mytest") echo $(test is SomeTestConcept) "nim c main.nim" produces: Hint: used config file '/home/gneu/nim/nim-0.15.2/config/nim.cfg' [Conf] Hint: system [Processing] Hint: main [Processing] Hint: typetraits [Processing] (and no further output) I think this has something todo with the typetraits module defining a proc or method "name" for types. Whatever the reason (and however stupid my sample code is), the compiler should never just stop working without giving the tiniest hint and what might be the problem.
Re: GTK 3.20 Nim wrapper
No not as a library. But I have not investigated the remaining crashes. I worked on it two months ago for the last time and used the editor then while working on the chess game. For me some crashes are no problem, I saved every ten minutes. And I think there are no other users beside me. One reason why I have not done further investigations was that there are still some bugs open in nimsuggest bug tracker, and I wanted not to add more. I think you have more important work to do. When I started with Nim two years ago I had a short look into aporia code -- there all nimsuggest related code was incapsulated deeply in try/except blocks with permannently restarting the nimsuggest process. I was not really happy with that design. My current code has no try/except and no restart of nimsuggest. For some problems I know why they occur, I have reported a few at nimsuggest bug tracker, and can report some more. For the remaining problems I have to do some investigations. Some problems my be GTK related, fixing these should be easy. [https://github.com/ngtk3/NEd](https://github.com/ngtk3/NEd)
Re: GTK 3.20 Nim wrapper
Do you use nimsuggest as a library? Because otherwise a crashing process should not break your editor process.
Re: GTK 3.20 Nim wrapper
Not nice solution, but better than having crashes when you work on code =)
How to use attatchment effectively in jester?
I write this code: get "/attachment": attachment "public/root/test.rar " resp readFile "public/root/test.rar " build on nim 0.15.2 , windows 7 run started : memeory used: 744KiB test.rar is about 5.158MiB, after download :memeory used: 46.855MiB It's totally unacceptable. So my question is : how to use attatchment effectively or correctly in jester? Thank you!
Re: GTK 3.20 Nim wrapper
Yes indeed, the test files needs some links before they work. For example in ~/ngtk3/nim-gtk3/test there is a file called "mach" (make in german language), I execute bash make followed by nim c test.nim and ./test. But these tests are nearly obsolete now, as long as chess works. It may be possible to avoid all these links when you enter all the wrapper directories and type somethink like "nimble install" there. I tried that once, it was working for me. But I guess it will generate problems for people who have installed the legacy aporia related gtk2 nimble wrappers. But when you manage to get nim-chess2 working, you can follow exactly that pattern for every Nim GTK3 application. You may also try the Nim GTK3 editor NEd from [https://github.com/ngtk3/NEd](https://github.com/ngtk3/NEd). I have not yet tested it with latest Nim v 0.15.2 -- with v 0.15.0 it was working, but still sometimes crashed. Some crashes are related to nimsuggest, so fixing is not that easy. Of course I may wrap the nimsuggest crashes with try/except and so more or less ignore it. But I consider that not a really nice solution.
Import from parent directory
Hello dear friends. I can import from subdirectories so: import subdir/some_module , or so: import subdir.some_module I can import from parent directory so: import ../some_module I can import from parent directory and it's subdirectory so: import ../subdir_of_parent/some_module But I can't use points there: import ..subdir_of_parent.some_module >> error Is it really one way to do this (while to import from subdir we can with two ways)? (if yes, why not to add ways with points only andor with slashes only?) Thank you.
Re: GTK 3.20 Nim wrapper
I took information from here: [http://nim-lang.org/docs/nimc.html](http://forum.nim-lang.org///nim-lang.org/docs/nimc.html) about path option and .cfg files, here: [http://nim-lang.org/docs/manual.html#modules-import-statement](http://forum.nim-lang.org///nim-lang.org/docs/manual.html#modules-import-statement) about import system, and added nim.cfg with:\--path: "gui"| ---|--- , added folder "gui", where were simulinks to all .nim wrappers - all worked. I'll try to work with it more. (system: Debian x64 unstable)
Re: GTK 3.20 Nim wrapper
I added gdk3.nim to the folder, where gtk3.nim was, it imported, now same error is while importing glib: """/home/vlad/Programs/programming/libraries/Nim/ngtk3/nim-gtk3/src/gdk3.nim(14, 6) Error: cannot open 'glib' """ Do I need to place them in one directory, or I can make some configure for this?
Re: GTK 3.20 Nim wrapper
Thank you, I understood my error. I need links to all those libraries (i placed test file with gtk3.nim in one folder). But I have now such issue: """home/vlad/Programs/programming/libraries/Nim/ngtk3/nim-gtk3/src/gtk3.nim(14, 6) Error: cannot open 'gdk3'""" with your test file from one of those libraries. Screenshot: [https://pp.vk.me/c638518/v638518447/8369/cWvQeHqwpRA.jpg](https://pp.vk.me/c638518/v638518447/8369/cWvQeHqwpRA.jpg)