Associate an enum with strings

2021-06-14 Thread halloleo
I have an enum like type Color = enum colRed, colGreen, colBlue Run What is the best way to associate strings with the `enum`? Define a separate variable like this?: let colorNames = toTable({colRed: "RED",

IRC freenode staff exodus

2021-06-14 Thread leorize
> I think only he can invite people at the moment (or maybe it's because things > are still a bit buggy?) The address for the Nim spaces is: [#nim:envs.net](https://matrix.to/#/#nim:envs.net), and there are currently 12 rooms within the space. Once you join however, you will likely only see 2-

call-by-value Y combinator

2021-06-14 Thread GordonBGood
> The 'Y combinator' Nim code on rosettacode does not seem to be a true Y > combinator. The following is the call-by-value Y combinator... I am the contributor of [the Nim RosettaCode Y-Combinator](https://rosettacode.org/wiki/Y_combinator#Nim), and noticed your post here but just got around to

IRC freenode staff exodus

2021-06-14 Thread Vindaar
> Also, we had a Matrix Community for Nim there but communities were superseded > by Matrix Spaces. Do we have one already? Yup, we do. @leorize created it, but I think only he can invite people at the moment (or maybe it's because things are still a bit buggy?).

IRC freenode staff exodus

2021-06-14 Thread Zoom
By the way. The address of the Matrix room on nim-lang.org is wrong. It's listed as `#nim:matrix.org` which is actually a room for some Node.js tech. The link itself (`#freenode_#nim:matrix.org`) is fine, if we're still ok with using Freenode of course. I'd like to see a proper Matrix room for N

Improving the documentation: Roadmap, community engagement.

2021-06-14 Thread DIzer
> Blonde and housewife jokes are not appropriate, please either edit or delete > your post. It is not a joke - it is reality whether you like it or not.. sorry

Improving the documentation: Roadmap, community engagement.

2021-06-14 Thread deech
Blonde and housewife jokes are not appropriate, please either edit or delete your post.

Improving the documentation: Roadmap, community engagement.

2021-06-14 Thread DIzer
> What if a reader comes from Lua, for example, where everything is a table? > How bad is it If the first > thing he sees is a small table of comparison > between different container types Nim provides in the > standard library? he will use it... as he did in Lua, Python, C++, Rust... depending

IRC freenode staff exodus

2021-06-14 Thread shirleyquirk
There's been enough time for the dust to settle, and with [this](https://linux.chat/linux-on-freenode/) from #linux i think the writing is on the wall. I hate drama, i admire this community for its attitude to "politics" (which can be summed up as: "do you have a Nim question?"). I know we have

NiGui - thread issue - what am I doing wrong ?

2021-06-14 Thread rockcavera
I've written a small Windows application using NiGui which uses thread for heavy processing and which makes the GUI usable. I don't know if it was the best solution, but here's a small example of how I did it: [example](https://github.com/trustable-code/NiGui/issues/91) Maybe a timer would be a

NiGui - thread issue - what am I doing wrong ?

2021-06-14 Thread IvanS
I'm trying out some stuff to see if NiGui is suited for my needs. Played a bit with editing samples, but got into an issue with threads. And I need those, or Windows will complain with a 'not responding' warning. I started with the thread example adding a text area and a button to play/pause. W

documentation for the `do` keyword?

2021-06-14 Thread timothee
the obvious missing feature here is to make keywords/pragmas searcheable in nim doc's search bar + theindex, so that searching for `do` would show the corresponding docs

Proposed table changes - get and getOrDefault

2021-06-14 Thread cblake
I said: > to have a **_new_** 2-body template If you click on my use case then you might see I was proposing a less cumbersome to use template that satisfies the laziness ideas (although you may have the sketch of an idea to impl it on top of the existing `withValue` outside of the `tables` mo

Proposed table changes - get and getOrDefault

2021-06-14 Thread Sixte
> Rust can do it because it can expose interior pointers Rust can especially do it because of `FnOnce()` , a function with state. `or_insert_with` gets the value to be inserted as `FnOnce()` and therefore the computation can be delayed. This is the (CBN-related) alternative that I mentioned abo

Proposed table changes - get and getOrDefault

2021-06-14 Thread timothee
> Another way to address both is to have a new 2-body template (I called this > editOrInit in adix/lptabz.nim) there's already `tables.withValue` which I think is what you're describing but it's less flexible than the proposed `getPtr` from , eg see

documentation for the `do` keyword?

2021-06-14 Thread Demos
do is a very old feature, it's somewhat inconsistent with the rest of the language but I personally find it useful

Proposed table changes - get and getOrDefault

2021-06-14 Thread Araq
> It would be really nice to provide an analogue of the Entry type with its > API: > > > It's extremely ergonomic. Rust can do it because it can expose interior pointers in a type-safe manner (it's called "borrow checking") an