thanks a lot :)
bindSym("internal_storagecompact", brForceOpen)
Run
helped!
If your macro is generating AST like `ident"internal_storagecompact"` then
change it to `bindSym"internal_storagecompact"`. `bindSym` by default uses
"closed symbol scope" in contrast to "open symbol scope", as in the symbol is
resolved when it's being generated in the macro rather than later.
Arrays cannot contain arrays of different sizes, you have to use seqs or just a
1 dimensional array that you treat as 2 dimensional. This is because the arrays
`[1]` and `[1, 2]` are different types.
If you want to split a big macros in multiple macros the easiest way to do that
is to use a `var MyTable: Table[string, NimNode] {.compileTime.}` that will
collect code fragment from one macro to another.
Simple example to transfer data between 2 macros when a `seq` suffices at:
* Parsing:
Unfortunately, that is not that simple...
Like I said in the introduction, the templates are generated by another
template. So the real code of my project looks like:
template generate(op: untyped, Typ1, Typ2, Tout: untyped) =
template `op`(a: `Typ1`, b: typed): `Tout` =
I get the following errors from Valgrind as the first ones which I can't
understand:
==16606== Invalid write of size 8
==16606==at 0x7EB9660: ??? (in
/usr/lib/xorg/modules/drivers/i965_dri.so)
==16606==by 0x7EBCAD7: ??? (in
For reference:
[https://github.com/nim-lang/Nim/issues/13973](https://github.com/nim-lang/Nim/issues/13973)
Thanks **TinBryn** , **gemath** and **Hlaaftana**. All your solutions work in
my tiny example. I'll adapt the last one to work in the macro that generate the
templates.
The missing ingredient from the other thread is the when test that guarantee
that the {.error: msg... .} pragma is printed at
Thanks! :)
I would add: **in any software, try to give precise and detailed error message
to the user of the cause of the problem**
Since a few hours, my tests don't compile any more and the message I have is
Error: type expected, but got: bool. I've tried changing the tests set,
expanded manually the
nim cpp mynimfile.nim
The c++ code is stored in the nimcache directory, see
[https://nim-lang.org/docs/nimc.html#compiler-usage-generated-c-code-directory](https://nim-lang.org/docs/nimc.html#compiler-usage-generated-c-code-directory)
Hi,
is there a way to generate c++ code from my .nim file?
Thanks, Minimisthupper
Report it on github please.
It doesn't work either. But bear in mind that this is a simplification. That
line will get replaced by somethin like:
for row in `obj_hess`:
for item in row:
values[idx] = obj_factor * item
idx += 1
Run
Which is not working.
It is very strange,
Have you tried writing it
echo repr(`obj_hess`[0])
Run
?
@dom96
True. I run docker-compose for consistency and separation mostly.
**consistency**
It almost guarantees that the instance on my local laptop will be truly
replicated on any instance I run on the cloud. My nginx configs always includes
`*.localtest.me` support.
Basically, I can test the
I am having an issue with a macro that I am not managing to solve.
The code is messy, but I will try to make clear the issue.
I have the source code
[here](https://github.com/mantielero/ipopt.nim/tree/master/src). When I compile
this code, the last lines displayed (from expandMacro):
I got myself in a problem with dividing visibility of my lib, I don't want
users to see any boilerplate, procs and methods they should not see.
### USER GAME MODULE
import actors # engine module
ComponentObject* = object
x*,y*: int
ComponentHealth* = object
Thanks very much for the help Yardanico, and for the example code.
I was not aware of the `option` capability, which sounds like a great solution.
I will give it a go in my program.
Thanks for for the tip on `float` vs `float64` too :)
I already [gave an answer](https://forum.nim-lang.org/t/6161#38066) in your
previous thread and people have answered already, but I'll give an answer that
shows more info in the error message. You don't need to import `macros` for any
of this, `astToStr` and `typeof` are in the system module.
This weekend playing with a macro I faced the following problem.
The following code [fails](https://play.nim-lang.org/#ix=2hQj):
import macros
proc hello() =
echo "hola"
macro function() =
let f = genSym(nskProc, ident="hello")
result = quote do:
> I thought Digital Ocean wouldn't have been an option with Nim, but Docker
> seems to make it possible...
You don't need Docker to run Nim on Digital Ocean (or any VPS/server hosting
provider). You've got a whole Linux machine to do with what you wish. Most of
the time Docker is overkill.
If "alerts" might not exist, you need to wrap it in Option (see `options`
module in stdlib) like
WeatherForecast = ref object
latitude: float64
longitude: float64
timezone: string
currently: Currently
daily: Daily
alerts:
Hi
I am after some advice please in the best way to handle a JSON unmarshal issue
I have for a hobby project.
I have been successfully using the Nim JSON unmarshal `proc to()` in my program
to extract the elements I want to use from a JSON API output - which happens to
be for weather forecast
I think is kinda the reverse, Nim may run everywhere that can barely run C or
JS. :)
No, I think it was a different book. Unfortunately I am not even sure if it was
written in English or German language. I would guess German, as I was really
not good at English at that time, but maybe it was written in an very easy form
of English. It was a thick book, maybe 400 to 500 pages,
If a distinct type is defined for the `val` field of `Real`, automatic type
conversion is not lifted to it:
type
strictlyFloat = distinct float
Real = object
val: strictlyFloat
Run
Should do what you want.
> We had a public library where I got many books, one was a nice Pascal book
> which I loved. Was not able to find it again.
Could it be [«Complete Turbo
Pascal»](https://archive.org/details/completeturbopas00dunt), by Jeff
Duntemann? This is the book I used to learn Pascal when I was a kid,
Maybe one additional note: I follow the Nim development now for about 5 years,
and from time to time fully unskilled people came to the community. Some asked
if Nim is well suited for beginners. Some Nim people said it is, like Dom, some
said it is not. I personally recommended Nim only to
> May be some fun, but how is that related to CS and programming?
I suppose you could consult with the folks at MIT who came up with Scratch,
unless you think they don't know anything about CS, programming, or learning
them.
> Learning is not always fun.
Oh, I'm well aware of that; I am by
Please consider talking about hosting in your web dev tutorial series as well.
31 matches
Mail list logo