Re: How to chain prodecure calls that mutate a reference object ?

2020-01-19 Thread ducdetronquito
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

How to chain prodecure calls that mutate a reference object ?

2020-01-19 Thread ducdetronquito
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

Re: Check if a procedure exists for a given type at compile time

2020-01-12 Thread ducdetronquito
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

Check if a procedure exists for a given type at compile time

2020-01-12 Thread ducdetronquito
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:

Re: How to parse RSS feeds with Nim

2019-12-23 Thread ducdetronquito
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.

Re: Advent of Nim 2019 megathread

2019-12-01 Thread ducdetronquito
Good catch ;)

Re: Advent of Nim 2019 megathread

2019-12-01 Thread ducdetronquito
Here we go :) [https://github.com/ducdetronquito/AdventOfCode2019](https://github.com/ducdetronquito/AdventOfCode2019)

Re: when to use 'ref object' vs plain 'object'

2019-11-21 Thread ducdetronquito
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 ?

Re: Import best practices

2019-10-20 Thread ducdetronquito
Thanks a lot, your article is really nicely written and straight to the point ! :)

Import best practices

2019-10-20 Thread ducdetronquito
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

Re: How to use testament ?

2019-10-13 Thread ducdetronquito
Ok, thanks for the clarification :)

Re: How to use testament ?

2019-10-13 Thread ducdetronquito
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.

How to use testament ?

2019-10-13 Thread ducdetronquito
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

Re: Define a procedure on a type itself ?

2019-10-11 Thread ducdetronquito
Thanks! I am so glad it exists :)

Define a procedure on a type itself ?

2019-10-11 Thread ducdetronquito
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:

Re: Nim for Beginners Video Series

2019-10-08 Thread ducdetronquito
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

Re: Trying to make dict in dict (table in table)

2019-10-08 Thread ducdetronquito
Hi @vbxx3 ! What is the type of httpMethod in the addRoute* method ? You haven't defined it in the method definition.

Re: Passing procedure as argument

2019-10-06 Thread ducdetronquito
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