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
@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
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
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
Thanks. I will have a look.
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.
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
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.
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
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
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 ;)
Agent? You mean to program a bot or some AI?
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
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,
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
`lim v -> 1` or buffer overflow / out of memory :D
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
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
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`
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
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.
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]
**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
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
**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
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
> 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
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.
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 ;)
> 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
> 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
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 .
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?
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
34 matches
Mail list logo