Re: What prevents you from using Nim as your main programming language?

2019-06-25 Thread avandy
No, I haven't tried. I want to explain that I would better understand - I admit that this is a good module, but the presence of such features out of the box in the design of the language itself, with a guarantee from the compiler is not the same. I liked the article on that -

optional params before `untyped` body

2019-06-25 Thread timothee
Is there a way to have optional params before an untyped body in templates/macros? The last case gives an error, that's the one I want: template foo(a1 = 10, a2 = "", body: untyped) = discard # works foo(3, "asdf"): for a in 0..<3: echo a echo 10

Re: Dynamic Tuple creation

2019-06-25 Thread juancarlospaco
assert (1, 2, 3) is tuple Run 樂?

Re: What prevents you from using Nim as your main programming language?

2019-06-25 Thread leorize
@cantanima @avandy Have you tried the [contracts](https://github.com/Udiknedormin/NimContracts) module?

Re: exporting API from submodules

2019-06-25 Thread leorize
The way I shown just avoids the import/export pair :p If you have more advanced needs (ie. import all module in a folder), then some macro magic can be used.

Re: What prevents you from using Nim as your main programming language?

2019-06-25 Thread scobra
Got to agree regarding the language comparisons. D takes the same approach wrt comparing itself against c++ and it just detracts from the newer languages in comparison.

Re: What prevents you from using Nim as your main programming language?

2019-06-25 Thread avandy
I am also a fan of Ada language. The only thing that limits my use of this language wherever possible is essentially having a single compiler from Adacore (gnat) and a GPL license. I have thoughts to start developing software for a specific platform (not x86). This immediately limits the choice

Re: Getting OrderedTable key/value pair by insertion order

2019-06-25 Thread squattingmonk
> So indeed iterating over the keys and stopping after first one makes sense, I > think there is no function to retrieve the first added element. And I think I > can remember someone asking how to get the n-th. added element, conclusion > was to use a loop similar as you do. Thanks, Stefan.

Re: What prevents you from using Nim as your main programming language?

2019-06-25 Thread kidandcat
Same, ecosystem, I needed to do WebRTC, and I couldn't affort to write the spec from ground up. Just a step to Go and you have a full implementation: [https://github.com/pion/webrtc](https://github.com/pion/webrtc)

Re: exporting API from submodules

2019-06-25 Thread hugogranstrom
Thanks both of you :-) Is there any advantages of using one over the other (for bigger project perhaps)?

Re: What prevents you from using Nim as your main programming language?

2019-06-25 Thread pigmej
For me it's the same as for few others here. Stability of the ecosystem/lack of libraries. The language itself is pretty neat though.

Re: What prevents you from using Nim as your main programming language?

2019-06-25 Thread rayman22201
> it became clear that everyone had been quiet about some really serious > problems. I don't think people were "quiet" per say. It's just such a small community that it took time for the problems to become apparent. It took time for projects to become big enough or creative enough to start

Re: What prevents you from using Nim as your main programming language?

2019-06-25 Thread rayman22201
@andrea I 100% agree with your first point. It is one of the main reasons I can't use Nim as my main language, but use it as my main hobby language. The community just needs to grow, in all senses. We need more projects, more libraries, more users, and more marketing. These are hard things, and

Re: Getting OrderedTable key/value pair by insertion order

2019-06-25 Thread Araq
Ok, yeah, we have no api for that.

Re: exporting API from submodules

2019-06-25 Thread leorize
Make a nim file of your choice (`testPackage/prelude.nim`), with the following content import testPackage / [submodule1, submodule2, submodule3] Run Then just `include testPackage/prelude` and all of your imports should be there. This approach is used by Karax.

Re: exporting API from submodules

2019-06-25 Thread kaushalmodi
`import testPackage/submodule1 export submodule1 import testPackage/submodule2 export submodule2 import testPackage/submodule3 export submodule3 ` Run

Re: Getting OrderedTable key/value pair by insertion order

2019-06-25 Thread lucian
use iterator pairs[A, B](t: OrderedTable[A, B]): (A, B) Run and break-out after first (does "... in insertion order." kind of implies FIFO?) element.

exporting API from submodules

2019-06-25 Thread hugogranstrom
I have divided my package into submodules and would like to export their API via the main module so all submodules can be imported by just importing it./src| ---|--- \--- testPackage.nim --- /testPackage --- submodule1.nim --- submodule2.nim --- submodule3.nim I have put a

Re: Getting OrderedTable key/value pair by insertion order

2019-06-25 Thread squattingmonk
I'm not trying to get sorted items, just the first item added (hence why I used an OrderedTable).

Re: Getting OrderedTable key/value pair by insertion order

2019-06-25 Thread Stefan_Salewski
>From your last code sample, I think I understand that you want to retrieve the >table entry, that was added first to table. So indeed iterating over the keys >and stopping after first one makes sense, I think there is no function to >retrieve the first added element. And I think I can remember

Re: Circular module dependencies

2019-06-25 Thread dom96
There is nothing wrong with asking in two places. Please don't criticize people for doing, or at least not in the way that you're doing it. It would be nice if the author added a link to Reddit and vice versa, but otherwise there is no problem in asking in both places.

Re: Getting OrderedTable key/value pair by insertion order

2019-06-25 Thread Araq
I don't understand the question: An OrderedTable keeps the insertion order, it's not a "SortedTable" (which the stdlib still lacks)

Re: Circular module dependencies

2019-06-25 Thread Araq
> will circular module dependencies be something that will be added to Nim? Yes, eventually. I personally would like to have a `submodule` concept for this so that the cycle is restricted to a set of "submodules" but the last time I brought it up it didn't have many sympathizers...

Re: Simple P2P library

2019-06-25 Thread pigmej
> Nim implementation of the spec. Oh nice @mratsim. Where is the work happening?

Re: Sequence of typeclass

2019-06-25 Thread leorize
Typeclasses in Nim is only used for generics, meaning that they're a compile-time constraint, not a runtime one. You'd need an object variant for this case.

Re: Circular module dependencies

2019-06-25 Thread mratsim
The usual way currently is to use a common "datatypes" file. See also the current discussion to improve the status quo: [https://forum.nim-lang.org/t/4745](https://forum.nim-lang.org/t/4745)

Re: What prevents you from using Nim as your main programming language?

2019-06-25 Thread mratsim
I'm using it as my main language but there are several reason why I don't push it in my data science communities: * I'd like a jupyter kernel/REPL for quick experimentation (arguably this is possible now with hot-code reloading). * Vtable (or working generic methods) would be very useful

Re: What prevents you from using Nim as your main programming language?

2019-06-25 Thread andrea
I have used Nim for many small experiments, but the main reason why I am not using Nim as my main programming language is that it is not popular enough. I know this is circular, but where I work I am the Nim person. If anything should go wrong on a project where Nim fails to deliver on some