Re: Update all installed nimble packages

2019-02-14 Thread zarican
Yes, you are right, I noticed that occurs if the user does not tag the repo too. That's why I updated my post with

Re: Update all installed nimble packages

2019-02-14 Thread GULPF
> Saying that I observe an ambiguity on the term "update" for nimble packages. > If I understood correctly a package developer registers the package with > nim-lang/packages and stores it on github. When someone installs the package, > files are downloaded from the github repo. Now, the ambiguit

Re: Update all installed nimble packages

2019-02-14 Thread zarican
Thanks @gemath for your thoughts. It is true that the priority is to carry Nim to well deserved 1.0 release at the moment but I think at some point not in the very far future, nimble should be improved and rehandled. I guess it is already in the roadmap. There are guidelines in nimble github pa

Re: Update all installed nimble packages

2019-02-14 Thread zarican
> On my system choosenim does, since it is Nim's toolchain manager. Not sure if > nimble updating itself as a package is recommended. As fas as I know, nimble does not install itself or nim, so my script does not either. I guess it will not be a problem.

Re: ptr arithmetics?

2019-02-14 Thread oyster
there is no official/bundle-in function/operator for ptr type, so what is the purpose of ptr type in nimlang?

Re: How to immutably initialize parent object with private fields?

2019-02-14 Thread bluenote
@lscrd: The `initElement` is also a setter despite its name ;). You cannot stop users from calling `element.initElement("different id")` and mutating the field at any point in time, which is what I'm trying to avoid. In fact that is also true for my template constructor idea via `newElement("di

Re: How to immutably initialize parent object with private fields?

2019-02-14 Thread lscrd
In this direction, to make it work, you have to do a cast: proc newElementA(): ElementA = cast[ElementA](newElement("A")) Run Another way consists to create a proc _initElement_ in _lib_ : proc initElement*(elem: Element, id: string) = elem.id

Re: Speeding up Python with Nim

2019-02-14 Thread cblake
If you want to _actually_ calculate Fibonacci numbers not use it as a (poor) benchmark for funcalls/recursive overheads or for other purposes, then you may also find this interesting: [https://sahandsaba.com/five-ways-to-calculate-fibonacci-numbers-with-python-code.html](https://sahandsaba.com/f

Re: How to immutably initialize parent object with private fields?

2019-02-14 Thread bluenote
@Stefan_Salewski: That what I meant with mutable setters ;). I'm trying to avoid them so that user can cannot arbitrarily reset the field. I finally had an idea that I can at least abstract away the mutation of the field: # in lib.nim template newElement*(idString: string, body

Re: How to immutably initialize parent object with private fields?

2019-02-14 Thread Stefan_Salewski
I tried it once this way: [https://forum.nim-lang.org/t/4226#26316](https://forum.nim-lang.org/t/4226#26316) After fixing the wrong var parameter type I think it was working as expected, but indeed we should have some lecture notes from the bright devs in a Nim textbook, together with the syste

How to immutably initialize parent object with private fields?

2019-02-14 Thread bluenote
I'm running into this problem in every project of mine, and I simply can't find a good solution, although the problem seems very basic. Let's say I write a dummy `lib.nim` like this: # The lib provides a definition of an abstract base type # without any actual instantiations...

Re: Screencast Series Ideas

2019-02-14 Thread ryukoposting
Was going to take care of that right now! If anyone has any suggestions, please let me know. Next videos are probably going to be a little bit shorter, but other than that I'm pretty happy with how the first one went.

Re: len [0, 1, 2] fails

2019-02-14 Thread ryukoposting
funny, for certain things I find that the command syntax (is that what it's called?) is quite nice. In the screencasts I make, when I call echo, I always just do `echo x` or `echo "hello"` etc. I like command syntax for things where the parentheses just make for visual noise. It certainly should

Re: Screencast Series Ideas

2019-02-14 Thread miran
And since @ryukoposting didn't do it himself, I must do it for him :) Here is his first video: [http://ryuk.ooo/videos.html](http://ryuk.ooo/videos.html) \- very nice presentation and explanations, I'm looking forward to the next ones!

Re: Update all installed nimble packages

2019-02-14 Thread gemath
> As I experienced myself too, whenever you ask to install the package, it > downlods the files with the latest commit ... nimble by default clones/checks out the current state of the default branch of a git repository. Which branch that is is configured by the repo maintainer. > ... , even if

Re: Error when test if a large number is prime!

2019-02-14 Thread mrhdias
Thanks for the hint!

Re: Update all installed nimble packages

2019-02-14 Thread gemath
> regarding excluding the compiler and nimble, does nimble update those? On my system choosenim does, since it is Nim's toolchain manager. Not sure if nimble updating itself as a package is recommended.

Re: Speeding up Python with Nim

2019-02-14 Thread Libman
I know it's not the main point of this article, but use of recursion kinda dulls the excitement of " ** _Speeding Up_** Python with Nim". Why not show the fastest fib version, with a loop? This runs many orders of magnitude faster. It also works for n>92 (int64 overflow). Pre-filling an initial

Re: The portable way to find nimbase.h or system.nim location

2019-02-14 Thread colinc
This does not seem to work for compilers installed via choosenim. When I compile nim code for embedded systems using the compilers from platformio, all I need a pointer to the location of nimbase.h. It would be ideal if choosenim could update a symlink (or similar) in a standard place so I don'

Re: Mix of varags & seq confusion

2019-02-14 Thread Arrrrrrrrr
But this works [https://wandbox.org/permlink/y9EYLm0EV6ULzrqS](https://wandbox.org/permlink/y9EYLm0EV6ULzrqS). It is a conversion I'm not aware of?

Re: Mix of varags & seq confusion

2019-02-14 Thread mratsim
Nitpick: strings are not openarray[char].

Re: Mix of varags & seq confusion

2019-02-14 Thread Arrrrrrrrr
[Varargs](https://nim-lang.org/docs/manual.html#types-varargs) > A varargs parameter is an openarray parameter that additionally allows to > pass a variable number of arguments to a procedure. The compiler converts the > list of arguments to an array implicitly [Open arrays](https://nim-lang.or