Hello everyone!
For those who didn't attend the NimConf, I just wanted to announce here a
project that I have been working on for the past 8 months,
[Omni](https://vitreo12.github.io/omni).
Omni is a new DSL to program audio algorithms in. It's been entirely written in
Nim, leverag
What i mean is: I tried it and it didn't work, as it would return the module
where currentSourcePath is called, and not the compiled nim file
I had tried it, but it will not work when used from an imported module
I will look into it, thanks!
Hello everyone!
Is there a way to retrieve the name of the .nim file that's been compiled at
compile time?
I see, it makes sense. Thanks!
Hello everyone,
I was wondering if I just stumbled upon a bug here. Why does this compile and
output `10`? Shouldn't it be an error to define variables with the same name of
arguments to the `proc`?
proc test(a : int = 0) =
let a = 10
echo a
test()
Thanks! It's nice to see this implemented :)
Hello everyone,
Is there a way of turning a compiler warning into an error? The reasoning is
that I am developing some code with custom memory management (using gc:none),
and I would want my code not to compile when a GcMem warning is thrown by the
compiler.
Thank you!
"I think we can get away with modelling the Nim AST in C via a single void*
type"
This one line killed me haha
I see your point, but I find `proc foo(args: ...): ... {.customMacro.}` to be
not so user friendly compared to simply `def foo(args: ...):`.
Especially considering that I am building this DSL also for teaching/learning
purpose of DSP/audio algorithms, so I can expect people using it not to have
hesis, it's still quite in its
early stages, but you can find it here:
[https://github.com/vitreo12/omni](https://github.com/vitreo12/omni)
You can get a peek at the current syntax from the examples folder (
[https://github.com/vitreo12/omni/tree/master/omni/examples](https://github.com/vit
I see. Well, it's kind of weird though that that specific syntax works with
other symbols that are not `:`. I'm working towards an intermediate solution
that creates temporary .nim files that turn `a : T = x` constructs into `a T =
x` ones, and using these latter ones in the macro logic. It stil
Hello everyone!
I am developing some DSLs using nim's macro system, and I would like to
implement my own function syntax. My aim is to have the syntax to look quite
similarly to Python's `def`
([https://docs.python.org/3/library/typing.html)](https://docs.python.org/3/library/typing.html\)).
H
That's what I ended up doing, thanks.
Unfortunately, your approach doesn't work because most of the flags that
`-d:danger` activates/deactivates are set in `nim.cfg`. In fact, if you look at
the binary size of your `hi.nim` file compiled with your method and with the
standard `nim c -d:danger hi.nim`, you'll see that the latter one
The only problem I'm finding now is that, considering that the general
`nim.cfg` gets executed before `config.nims`, if I add the `-d:danger` flag to
`config.nims`, it doesn't actually get applied to the resulting binary, as the
behaviour for `-d:danger` is defined in `nim.cfg`. Is there a way t
Because I'd simply want the user to run `nimble install` without having to
provide additional flags when installing my package. This comes from the fact
that the user can't use the custom flags that I provide in my nimble package
before cloning the repository first. So, it's not possible to do `
Hello everyone,
Is there a way to add custom compiler flags (e.g. `-d:danger`) to the `nimble
install` task? I know that I can use the `--passNim` flag on the nimble call,
but I was wondering if this could be directly abstracted from the user in the
nimble file of my package. I tried creating m
This is fantastic news, congratulations to the dev team. You guys are amazing.
Thank you. What I find weird, then, is that nimsuggest appears to be working
just fine with other editors (like Viscose).
Have you perhaps succeeded in using flymake instead? When I turn flymake-mode
on, it just won't highlight any errors.
Hello guys,
I have been trying to use Emac's nim-mode
([https://github.com/nim-lang/nim-mode](https://forum.nim-lang.org/postActivity.xml#https-github-com-nim-lang-nim-mode))
and everything seems working fine, except for the linters. I am finding
flycheck to be extremely buggy, and I wanted to
Thanks for the answer. I tried your example and it indeed works, even though I
would prefer the simpler syntax of `T : typedesc[SomeNumber] = typedesc[float]`
to work. In any case, I also came across this other error, when trying to limit
the `T` inside the `SomeObject` definition:
Hello everyone, I was wondering if I just found a bug or if there is something
wrong with the following code:
#ex1
proc test1(T : typedesc[SomeNumber] = typedesc[float]) : T =
echo "type is " & $T
return T(0)
#works
echo test1(int)
#ex2
Hi everyone,
I know that in Nim is possible to call C functions compiled to a shared
library, but I was wondering if it could be possible to compile a C file with a
set of functions directly with the Nim source, without having to compile the C
file to a shared library first. If this is possible
I just realized that this syntax seems to compile, even if it doesn't work:
proc returnZero[T = float]() : T =
return T(0)
Run
Will this syntax work in the future? I think it is quite neat in its separation
between types and values, opposed to the typedesc impl
To be honest, I don't particularly like the idea of a different proc name for a
default state, especially if the code will be reused by others.
Thanks for the answer.
The system.default() is a nice option, but the code I proposed was only a
minimal example, in my real case I don't need to return a zero.
Regarding the option you proposed, I only have the problem that I would still
like to maintain the
let val = returnZero[
Hello everyone,
I have a function that looks like this:
proc returnZero[T]() : T =
return T(0)
Run
and I would like to provide a default implementation that doesn't not require
to call the T type, defaulting it to float64.
The call would look like:
Thank you all for your answers. I tend to use objects more than tuples too, due
to the features that @juancarlospaco highlighted. Following the discussion,
what do you guys think of concepts? How would you use them to structure code? I
could not find relevant documentation on those, and failed i
Hello everyone, I hope that this question is clear enough, and that it
hopefully can stimulate a healthy discussion. I have been using Nim daily for
now a month, and I am still wondering about the most idiomatic way of composing
objects and structure the code in Nim. I know that there is support
Thank you, it makes perfect sense.
Thanks, it worked! Shouldn't dumpTree do exactly that?
Hello everyone, I would need to debug the NimNodes returned from
getImpl
Run
calls, and I was looking for a function that would print out a NimNode tree
structure given a NimNode, not a block of nim code. I looked at
dumpTree
Run
, but it
Hello everyone, Is it possible in Nim to have a macro/template that starts with
a custom character? For example, a macro like:
#Declaration
macro @myMacro() :
...
...
#Usage
@myMacro
Run
Isn't
MyRefObject()[]
Run
allocating an unitialized instance of the type? Isn't there a way to achieve
the same thing without creating an object of the type?
Hello guys,
I was wondering how to retrieve the size of a type declared as a
ref object
Run
Consider this example:
type
MyObject = object
a : int
b : int
c : int
MyRefObject = ref object
Thank you all very much for the welcome and for all the help! I know see where
the problem is, and I hope that, in the future, an easier syntax would work.
In any case, I went with the following solution, using a generic type at the
type level and specializing only in the procs' interface:
Hello everyone! I am a new Nim user (and, I have to say, I am pretty excited
about this language!) coming from Julia. I was tesing some of Nim's
capabilities when coming to generic types and procs, when I ran into this code
not compiling:
type
AbstractType = int or string
39 matches
Mail list logo