Re: Can I disable the GC and use "gc:none" or the "new runtime" for only parts of the code?

2019-09-29 Thread komerdoor
I am okay with managing my own memory. I mostly statically allocate, allocate on the stack and/or have large memory pools. Thank you for all those examples. They answer more questions than what I was asking for, like alignment and prefetching :D. My current C code divides work in batches and di

Re: Can I disable the GC and use "gc:none" or the "new runtime" for only parts of the code?

2019-09-28 Thread komerdoor
@Araq I see you already answered this question once when I used another username I forgot about. Sorry :D Also Nim seems to prefer that you copy list collection data-structures like seq etc. instead of sharing them between threads, but this time I really have to share them between multiple work

Re: Can I disable the GC and use "gc:none" or the "new runtime" for only parts of the code?

2019-09-28 Thread komerdoor
So should I enable Nim's soft realtime GC for everything and then use `ptr` where I want to manage memory myself? Is that the default, what should I do to use it? Can I compile using C99 to be able to use the `restrict` keyword with `emit`? As an example, this is how I implemented one batch pro

Can I disable the GC and use "gc:none" or the "new runtime" for only parts of the code?

2019-09-28 Thread komerdoor
to have the following layers: high level: non-compiled game code for modding using Nim script ([https://github.com/komerdoor/nim-embedded-nimscript](https://github.com/komerdoor/nim-embedded-nimscript)) mid level: compiled game code using garbage-collector low level: data-oriented game engine

Re: Been away for 9 months. What changed? Need some help to get back on track.

2017-08-26 Thread komerdoor
Thanks. I will have a look.

Re: A talk on HPC

2017-08-26 Thread komerdoor
I started working on a project like this a while ago supporting OpenCL C, GLSL and SPIR-V. Not to be used for physics, but for machine learning and game programming. Nice to see other ways of doing this.

Been away for 9 months. What changed? Need some help to get back on track.

2017-08-26 Thread komerdoor
I've been away from Nim for about 9 months. Can anyone give me a quick update about what happened in this time to help me get back on track? A summary of the last things I did and my level of understanding Nim at that time: [https://news.ycombinator.com/item?id=13357533](https://news.ycombinato

Re: How to start NIM on Linux ?

2016-12-11 Thread komerdoor
Knoppix 6.2 is from 2009, that is pretty old for something as organic as most open-source projects ;) You should really use a more recent Linux distro release. P.S. Subscribe to the YT channel Cosmic Soundwaves, it has more of this kind of music.

Re: How to start NIM on Linux ?

2016-12-11 Thread komerdoor
I think this is because Knoppix is based on Debian Stable which has no official Nim package. Do the following in a terminal to download the package: `wget http://http.us.debian.org/debian/pool/main/n/nim/nim_0.15.2-2_i386.deb` And then after running that command do the following to install the

Re: GUI programming

2016-12-11 Thread komerdoor
Still do not get what you mean with that :p Anyway. Good luck with trying out some of the GUI libraries. Note that you should at least try to get some things to work by yourself. Most GUI libraries have documentation or examples. If you cannot find Nim specific ones you may look at the C, C++ o

Re: How to start NIM on Linux ?

2016-12-10 Thread komerdoor
I already answered that question above. Knoppix is Debian based. Try `sudo apt-get install nim` from a terminal. Also no need to start and end with a greeting everytime ;)

Re: GUI programming

2016-12-10 Thread komerdoor
Agent? You mean to program a bot or some AI?

Re: GUI programming

2016-12-10 Thread komerdoor
Just try them all (not only libui) and see what you like best. Create a simple _hello word_ button. You will also learn that most GUI libraries are not that different from each other. May be only some features. The same counts for different programming languages as well. New paradigms are more

Re: How to start NIM on Linux ?

2016-12-10 Thread komerdoor
Yes, at (you may also try the unstable one): [https://packages.debian.org/stretch/amd64/nim/download](https://packages.debian.org/stretch/amd64/nim/download) You may also find other packages there. Just search for them. Sometimes you have to download all the dependencies you are missing as well,

Re: GUI programming

2016-12-10 Thread komerdoor
Yes. But for most of them you are actually using and learning the same interface as the one you would use when using C, Python etc. I am not sure if you are new to programming. In modern programming it is best to be flexible about learning new libraries. The way all the different GUI libraries

Re: Newyear is coming , is 2017 the year for nim?

2016-12-10 Thread komerdoor
`lim v -> 1` or buffer overflow / out of memory :D

Re: GUI programming

2016-12-10 Thread komerdoor
You can also use `libui`. A simple cross platform UI library. I found a Nim wrapper at (by Araq): [https://github.com/nim-lang/ui](https://github.com/nim-lang/ui) If you need a UI for use in a game or very interactive application you may try out a Immediate Mode Graphical User Interface. Have a

Re: How to start NIM on Linux ?

2016-12-10 Thread komerdoor
I updated my comment above. If the computer is offline. Download the packages from a computer with an internet connection and store them on a USB drive. In Debian and Ubuntu you can use `apt-get download nim`. Store the downloaded files on a USB drive. On the offline computer, after mounting an

Re: How to start NIM on Linux ?

2016-12-10 Thread komerdoor
Hello Menno, To add a directory inside the path you can do `export ${PATH}:/some/directory`. Modify `/some/directory` to the directory where the `nim` binary (executable) resides. You can also add this line inside the hidden files (every file or dir that has a dot . in front) named `.profile`

Re: Using concepts for generic structures

2016-12-10 Thread komerdoor
Tnx. I read the document `generics.txt` before I started using the `concept` keyword. Somehow I was under the impression concepts could be parameterized for me to refer to the contained value. Of course a container type may not even have `value` (it could be a function type or have a pair of va

Re: Using Nimscript as an embedded scripting language?

2016-12-08 Thread komerdoor
I added an example of how I embedded Nimscript in my Nim application at: [https://github.com/komerdoor/nim-embedded-nimscript](https://github.com/komerdoor/nim-embedded-nimscript) Still working (between other things) on the automatic binding generator.

Using concepts for generic structures

2016-12-08 Thread komerdoor
I want to do the following in a generic way: type Constant[T] = object value: T # For testing: 'int' acts as monoid under addition proc `&`(a: int, b: int): int = a + b proc `$`[T](a: Constant[T]): string = $a.value proc `==`[T]

Re: Error: illegal capture 'a' -- I have no idea what that means

2016-12-08 Thread komerdoor
**Krux02**: I found the following document earlier today that explains some of the internals: [here](http://forum.nim-lang.org///nim-lang.org/docs/intern.html#code-generation-for-closures) I also made [this](https://gist.github.com/komerdoor/70d9c25820952624cf797890a18f9cd5) several months

Re: Code generation from AST with annotations in Nim like in C

2016-12-07 Thread komerdoor
I will be happy to share my project as soon as I get the first parts to work. A long time ago I created a portal renderer. It used recursion and frustums that extended from each portal. Something like this: # Pseudo proc cellRender(cell, frustum): ... for o in c

Re: Code generation from AST with annotations in Nim like in C

2016-12-06 Thread komerdoor
**Krux02**: I had a look at your opengl-sandbox code and got most of the examples to compile. Had to modify the font path and remove the regexp code that triggers a conflict between `pure/options` (nice to know Nim has them :) ) and `compiler/options`. Your code really shows the power of what i

Re: Code generation from AST with annotations in Nim like in C

2016-12-06 Thread komerdoor
I did something similar to `array[M, Vec[N,T]` when I wrote my math library in C, but somehow it did not occur to me to do the same in Nim. The reason that I am looking into Nim (again) is because I ran into limits creating a compute kernel DSL for C. I want to be able to write formulas (using

Re: Using Nimscript as an embedded scripting language?

2016-12-06 Thread komerdoor
> Read nimble's source code of how to accomplish this. Thank you. I had a look at the Nimble code and tried some pretty complex things already. The only thing I could not get to work are macros, but am really happy with what Nimscript can already do. Some more things I should be aware of? I alr

Re: Using Nimscript as an embedded scripting language?

2016-12-06 Thread komerdoor
Thanks. I had a look at the compiler code and found `scriptconfig.nim`. Still figuring out what exactly I should do to integrate it in my Nim application.

Re: Code generation from AST with annotations in Nim like in C

2016-12-05 Thread komerdoor
Thank you, that worked perfectly. I can now finally create and initialize objects on the stack. I also just found out that arrays in Nim get initialized to zero automatically ;)

Re: Code generation from AST with annotations in Nim like in C

2016-12-04 Thread komerdoor
> Then when you are on the development branch of nim, error has a second > optional argument, that allows you to pass a NimNode, so that positional > information from that node gets printed on the cosole whe the error occurs. I am using that now. Tnx. Do you by the way know if Nim supports stat

Re: Code generation from AST with annotations in Nim like in C

2016-12-04 Thread komerdoor
> Does your own answer mean you already answered the question yourself? Yes, the second post describes how I solved it. > instead of this ... you can do this: definition.expectKind(nnkProcDef) Nice to know this exists, but I want the switch / case / match to generate different code depending on

Re: Code generation from AST with annotations in Nim like in C

2016-12-04 Thread komerdoor
I managed to create a macro that creates a wrapper for functions that have the "scriptExport" pragma. It was easier than I expected. import macros proc expandFormalParamsForCall(formalParamsNode: NimNode): seq[NimNode] {.compileTime.} = result = @[] for i in 1 .

Using nimscript as an embedded scripting language?

2016-12-04 Thread komerdoor
Is it possible to use Nimscript as an embedded scripting language instead of for example using Lua? And if possible, can I create bindings for my own functions and restrict which built-in functions can be called from the scripting language?

Code generation from AST with annotations in Nim like in C

2016-11-27 Thread komerdoor
I use annotation macros in C to generate new C code from the AST. For example in C, where the X macro uses the GNU annotate attribute, I do the following: // Type definition (can access fields from script) X(script) typedef struct { int value; } something_t; // yes I k