Hey !
Thanks you for the quick answers !
As @solo989, just returning var Child like in the snippets below does not work
has it triggers a compile error.
proc set_value*(self: var Child, value: int): var Child {.discardable.} =
self.value = value
return self
Hi there !
I am trying to chain procedures that mutate a reference object, but I can't
managed to do it.
Here is a minimal example:
type
Child* = ref object
value: int
Parent* = ref object
child: Child
proc
Wow, I didn't think about cyclic imports at first !
I ended up with the approach you mentioned: using a proc type field with a
default value that can be overriden by the end user with a setter.
Finally, messing around with type introspection would have been more
complicated to understand
Hello everyone,
I would like to know if Nim allows me to check if a procedure exists for a
given type at compile time ?
.
# As a library author I define a type `Car`
type
Car = object
speed: int
proc default_drive(self:
Simple and straight to the point article, good job :)
Ps: On your home page, the excerpt does not display nicely as it shows a
portion of the RSS feed in the article.
Good catch ;)
Here we go :)
[https://github.com/ducdetronquito/AdventOfCode2019](https://github.com/ducdetronquito/AdventOfCode2019)
Dammit ! That error has bitten me this weekend and I wasn't able to understand
its origin by reading the error message.
Does someone why plain objects do not work with async ?
Thanks a lot, your article is really nicely written and straight to the point !
:)
Hi everyone,
Being new to Nim and coming from Python, I often find myself struggling with
imports.
For example, I play with the asynchttpserver module of the standard library,
and I don't know how to properly import it.
**Solution 1** :
Everything is imported, but is it OK to import/pollute
Ok, thanks for the clarification :)
Thanks for the quick reply !
I will look into the code of the Nim compiler. But is there any other project I
could look at ?
Even though I am currently toying with the language, I expect to build
production grade application at some point, so I don't want to use already
deprecated components.
Hi everyone !
I was looking to add unit tests to my toy project, and the
[documentation](https://nim-lang.org/docs/unittest.html) leads to a tool called
testament.
Unfortunately, there is no documentation about it
[yet](https://github.com/nim-lang/Nim/issues/12251).
Until it comes, do you
Thanks! I am so glad it exists :)
Hi everyone,
I am wondering if it is possible to define a procedure on a type itself ?
Coming from the Python world, it would be called a _class method_ or a _static
method_.
I really like to use this kind of syntax to create objects, and in Nim I
imagine it could work like:
Hello @Kiloneie !
First really nice job, keep going there is not much of these Nim tutorials out
there !
My only advice would be to make your voice more clear. Right now, your voice is
a bit low and the sound of you hitting your keys is a bit loud. Maybe you could
first record the video and
Hi @vbxx3 !
What is the type of httpMethod in the addRoute* method ? You haven't defined it
in the method definition.
Hello vbxx3,
I am new to Nim but I think what you are looking for is called **procedural
types**.
You can find some information about them in the [Nim
tutorial](https://nim-lang.org/docs/tut1.html#advanced-types-procedural-type)
and in the
18 matches
Mail list logo