When doing manual memory management in Nim, I often find myself having to
define two versions of a proc - one that takes a `var` parameter and one that
takes a `ptr` parameter.
Otherwise I will run into issues like this:
var m: ptr Monster
var b: Bullet
proc
I guess it's just semantically not how Nim works.
A proc has 1 body. However, if you use static/generic parameters then different
versions of the proc body will be generated at compile-time based on the input.
proc say(n: static int) =
when n == 1:
echo "static one!"
Ironically I don't think Uncle Bob would like Nim at all, given our general
preferance towards straightforward "get shit done" procedural code. For example
in [this video](https://youtu.be/IRTfhkiAqPw?t=1179) the author critiques some
of Bob's code and rewrites it in a simple procedural style.
There are some solutions, but all a little awkward.
1\. ["do"
notation](https://nim-lang.org/docs/manual_experimental.html#do-notation),
which I believe was moved to _experimental_ just before Nim 1.0, therefore
might be changed or scrapped in a future Nim version.
Personally I think it's
This is looking absolutely stellar! Have really wanted something like this, was
thinking of making my own but didn't know where to start. I'm definitely gonna
try this out :)
This is cool! I gave it a spin and it Just Worked™ with the latest raylib dll,
very painless experience :)
Some thoughts:
As neat as this generator page is, I'd rather have a regularly updated nimble
package. But hey, you've already done the hard part! Maintaining such a package
would be a
Hey, can we make this happen? I use Discord a lot and would love to see the Nim
server expanded. I feel like the community is big enough now for it work.
doin' it
[https://github.com/exelotl/aoc2019](https://github.com/exelotl/aoc2019)
> Then, I need to import this C var into nim? This does not look like a good
> idea.
Yeahh, in my project I'm using this pattern all over the place, because it's
basically the only option right now. It works but it's cumbersome, I'm looking
forward to the day when Nim has a proper solution to
Yep, I chatted to Araq about this yesterday on IRC, and he arrived at the same
conclusion. I'll submit an issue for it later today :)
Yes, I was not suggesting that Nim should disallow it, but that _if arr was
generated as const in C_ then it should fail to compile at the C stage. And
that should be acceptable behaviour, since I used `unsafeAddr` after all, and
Nim has made no promises about arr being mutable.
Hey! For several months I've been working on a Game Boy Advance game in Nim.
This has been a great experience for the most part. For example I used macros
to hugely reduce the amount of boilerplate required to load and draw sprites,
preventing a lot of human errors with no performance cost.
12 matches
Mail list logo