Related: if you want to unpack other datatype, there is `unpack` package:
[https://github.com/technicallyagd/unpack](https://github.com/technicallyagd/unpack)
What do you think about using Nim in place of Java, C#, and legacy Delphi for
enterprise software development?
It looks for me as a technology very interesting for the small business market,
where there are no resources to rent or invest in hardware and expensive
software for huge processing wi
yes
[https://github.com/nim-lang/nimble/issues/633](https://github.com/nim-lang/nimble/issues/633)
Is it possible to pass arguments to nimble tasks? I want to pass the filename
to run one test like this:
nimble test filename
Run
`doAssert f is float` is the way to assert the type.
I think this is what you are looking for:
[https://nim-lang.org/docs/manual.html#statements-and-expressions-tuple-unpacking](https://nim-lang.org/docs/manual.html#statements-and-expressions-tuple-unpacking)
proc returnsTuple(): (int, int, int) = (4, 2, 3)
let (x, _, z) = ret
This may not be a critical issue but I am trying to understand the basics well
to be able to build on them. This is what I think I know:
When we declare a variable, we declare it with a type:
var
i: int = 0
i3: int8 = 1
f: float = 0.0
f32: float32 = 3.14
thank you, that did the trick
the `-f` command line parameter of Nim will force a rebuilding of ALL modules
I'm getting warnings about modules imported but not used and I want to fix my
code. The second time I compile the warnings to do show up. How do I get the
warnings to appear again? The second compile is much faster, so I'm thinking I
might have to delete the cache. Is this correct? Where is it?
I think about using inheritance to achieve this. Nim, as pascal, delivers many
method to use countable types, like splices, etc.
I will write type, which contains seq of strings and I will implement method to
get string from this sequence by index. Other method will get index of string.
One que
Hello,
I was looking into creating genuine ref types with finalisers. Is there a way
to attach a finalizer to a type without using new(...) ?
It seems that Nim is attaching a finaliser statically, but only does that if
new() is mentioned somewhere in the program. This is what I found to be work
Thanks a lot. I was trying to write macro that generates: enum type and
procedure to map value of this enum to related string. I decided to port game
based on Freeciv. I'm only developer of this game and introducing a new
features takes too long. Freeciv (and my game) is write in C and uses
x-i
I appreciate your words. Hopefully, I can get more chapters coming. btw, I love
dom's work! it's well written and has lots of clear explanations and I think
both books can complement each other
Not yet AFAIK. We're still waiting on @rayman22201's patches to be finalised.
Can you provide any example how to use a modern database
(Sqlite3/Mysql/Postgres) with Nim on Windows? I've tried to use Postgres, but
libpg was not detected properly.
Hi,
I've been using a macro to turn thread spawn into an async call that had been
[shared previously](https://forum.nim-lang.org/t/3648#22852) on this forum.
With Nim 1.0.0 and improvements to asyncdispatch, I'm wondering if this
capability made its way into the standard library yet?
Sorry if
This description still seems rather "Minimalistic languages" focused. What is
the official title of this devroom? Why do we need to focus on minimalistic
languages where our devroom was aimed at _emerging languages_?
Hmm, looks like you have quite a bit to understand.
Your macro line is also indented too much, it should be on the same indentation
level as the type declaration.
This line:
echo """{name} = enum\n "
Run
needs to be this:
echo "{name} = enum\n "
Your first file has an extra space on each echo line after the for loop. Remove
that and your program will compile.
However, that is not how you write a macro. You need to generate NimNodes
instead of just printing to the screen. I can give an example when I get to my
computer.
ok je vais aller regarder
ok i'll go watch
thank you
I work mainly with JS and Go, and I can tell you I love Nim because I can copy
the same program from Go to Nim and it will have like 10 times less code
type
VALUE = object
d: uint32
#proc init(v: var VALUE) = # working code
# v.d = 3
proc init(v: var VALUE | ptr VALUE) =
when v is ptr VALUE:
v[].d = 1
else:
v.d = 2 # compile error
var v: VALUE
v.init()
echo repr v
`echo` just prints to terminal, like `print` on Python, `puts` on Ruby, `echo`
on Bash, etc.
I find that it is more readable when you declare what data type it is. You
don't have to comment as much, so it is more orderly IMHO. I think Python have
the extreme edge on most language with all these libraries. It seem neural
networks and AI in general is leaning towards python, and AI is the
Have you looked at [Tables](https://nim-lang.org/docs/tables.html) ? They are
like hash maps.
Sorry for that (probably) simple question, but I have indentation problems
(compiler complains about it):
First file:
type
progress_specenum_el = object
name: cstring value: string
macro generate_specenum(name: string; elements:
openarray[progress_specenum_el]): untyped =
ech
I receive different types of object from network, packed as msgpack. Now i need
a construct that creates objects of the given type, to work with them further.
I'm struggeling to create a proc/template that does this in one call. My goal
is to get something like this:
var msgObj = u
Bonjour,
voilà j’arrive du c/c++
j’utilise les struct
j’ai fait une correspondance avec (tuple objet)
par contre j’aurai aimé me servir de map tel que le c++ me le propose
le but : avoir une petite banque de données interne au programme pour faire
soit des simulations ou des outils internes.
This makes perfect sense, now I have more arguments when recommending Nim to
advanced programmers. Thank you for your answers. I am planning to make a tiny
toy language(I have a lot of reading and practise to do). Is nimly the way to
go? Are there any manuals available? Thank you for all answers
A lot of people find Nim's expressiveness comparable to Python. I find static
types in Nim increase productivity even over Python although the ecosystem and
tooling are not that rich.
IME Nim code is almost always shorter and it's easy to see why: It doesn't have
lines full of `} } }`. ;-) That's hardly an objective bonus to "productivity"
because syntax is simply not that important.
> How compact are Nim applications?
It depends on the coding style.
> Can one write a Nim e
> I would say 20%
That is surprising for me. I would have assumed that Java is not a good choice
for a chess engine using (rotated) bitboard representation. As Java uses most
of the time reference semantic with indirection, not value semantic. And as
Java was not really designed initially for l
Interesting ! I will measure and compare speeds of both...
Well, regarding java... efficiency is lower than C or Nim... I would say 20%
for CPU intensive apps, not more. The memory consumption is also excessive in
Java. But conceptualization is convenient. Here is an example of java bit
iteration (cryptic but working):
protected static fi
I have a question that I have been thinking about since I discovered Nim. How
does Nim compare to other languages like C/C++, python,Java as far as
productivity and terseness? How compact are Nim applications? Can one write a
Nim equivalent to a C++ program in dramatically fewer lines of code? A
36 matches
Mail list logo