Re: Deprecation warnings

2019-12-04 Thread Araq
You can simply use `uint` (or `int`) instead which works with every Nim version.

Re: Sublime Text 3 support

2019-12-04 Thread e
Yes, @Hendrik, Nimlime uses the nim that is installed and on your PATH.

Re: Sublime Text 3 support

2019-12-04 Thread Hendrik
Hi e, Well what I wanted was the latest version of NIM in ST. But I believe it might be my lack of understanding on how Nimline works. For instance, I thought that Nimline includes a version of NIM that it runs but it seems from what you are saying is that it alows you to use NIM in any version

Re: generic typevariable binding

2019-12-04 Thread e
Thanks @mratsim \-- I'll use your `weight = V(1)` suggestion. I'm sorry you had to fill in missing bits... the failing code is [here](https://github.com/dcurrie/AdventOfCode/tree/master/Utils) It fails if you uncomment the test case in `dijktra.nim` and try `nim c -r dijktra.nim`

Re: {.gcsafe.}, What does {.threadvar.} do to make a function gcsafe?

2019-12-04 Thread mratsim
Iirc the gcsafe requirement was made so that it would not be breaking in the future to make async threadsafe.

Re: Mix of types in division operator '/'

2019-12-04 Thread mratsim
> as it both leaves the div keyword to be used for a different purpose that is > more appropriate and necessary Maybe for you, but I think division is a necessary operation. Besides div is not a keyword, you can overload it: proc `div`(body: string): string = "\n" & "

Re: Set object field from strings at run time?

2019-12-04 Thread mratsim
Approximate fields setter and getter with JsonNode and some experimental dooperator magic (from [https://forum.nim-lang.org/t/5000#31345](https://forum.nim-lang.org/t/5000#31345) and [https://github.com/status-im/nim-cookbook/blob/master/dynamic_approximating_dynamic_types.nim](https://github.c

Re: generic typevariable binding

2019-12-04 Thread mratsim
The example is missing a bit of proc for reproduction but this compiles for me (though it segfaults at runtime after). import sets, tables, hashes type DEdge*[K, V] = ref object fm*: DNode[K] to*: DNode[K] weight*: V DNode*[K, V] =

Re: Deprecation warnings

2019-12-04 Thread mratsim
The proc that now accepts csize_t instead of csize should have a deprecated overload to ease the transition (or a converter but converters tend to create hidden bugs in my opinion)

Re: UI showcase ideas

2019-12-04 Thread mratsim
We have a demo chat app using NimQML. However, I think most of us had issues with DOtherside compilation at one point or another. Also it hasn't been tested for a while but we pinned all dependencies via submodules including the Nim compiler so it should be OK. Now about the app, it's a Nim pro

Re: CountTable inconsistency?

2019-12-04 Thread onde
Created an issue [on Github](https://github.com/nim-lang/Nim/issues/12813)

Re: CountTable inconsistency?

2019-12-04 Thread onde
Thanks Araq. Just to explain: I'm reading a user provided histogram, which is by right a CountTable, but I need to delete certain keys post ingestion. Since CountTable doesn't provide a del() I had to resort to setting the key to 0, which surfaced the bug above.

Re: CountTable inconsistency?

2019-12-04 Thread Araq
Sounds like a bug to me but a count table is for counting. Setting a value to 0 is not counting, you're doing something else, use an ordinary table.

generic typevariable binding

2019-12-04 Thread e
With a `type` that depends on two generic typevars, the type inference implementation seems to get stuck on a particular binding of the second typevar based on the first... is that expected? Specifically, for these two sections: var w = DGraph[int,int]() let _ = w.add_edges(@[(

UI showcase ideas

2019-12-04 Thread filcuc
I would like to showcase the potential of my nimqml bindings. Abu idea for a possibile usefull app? Yet another to do list?

Re: Sublime Text 3 support

2019-12-04 Thread e
[Nimlime](https://github.com/Varriount/NimLime) works for me, at least for syntax(-error) highlighting and jump to definition. It has not been updated for about a year, but I've had no issues, though there are some listed on github. What trouble are you having?

Re: Any possibility of a near term Lazarus/C#-like GUI-designer IDE?

2019-12-04 Thread juancarlospaco
The problem is actually choose which one, they all look cool in its own way. 🤪

Re: Any possibility of a near term Lazarus/C#-like GUI-designer IDE?

2019-12-04 Thread treeform
I am trying to make a UI based tool that use Figma to draw the UIs. Idea is that you draw your UI in Figma and export it to run with Fidget: [https://github.com/treeform/fidget](https://github.com/treeform/fidget) . I hope to target HTML, Win, Mac, Linux, Android and iOS.

Re: Any possibility of a near term Lazarus/C#-like GUI-designer IDE?

2019-12-04 Thread stph
Thank you all for the friendly and very encouraging responses. Congratulations,also, to the developers for your recent 1.0 achievement! I expect I would have looked at Nim before now (as all I've ever heard about the effort has been good) but there's typically a huge gap between alpha and 1.0,

CountTable inconsistency?

2019-12-04 Thread onde
Hi all, new forum member here. Please be forgiving. I think I discovered an inconsistency in CountTable. I couldn't find a way to delete a key (no del() implementation?!), so instead I set its value to 0 as recommended in [this Stackoverflow Post](https://stackoverflow.com/questions/59160984/r

Re: Any possibility of a near term Lazarus/C#-like GUI-designer IDE?

2019-12-04 Thread sky_khan
> Has there been any thought of adapting it to self-reflectively work with Nim? Well, I had played with this idea a bit. Then I've realized I cant reconcile their exceptions. I had to wrap all inter-calls with expensive try-except blocks or your program will crash at first run-away exception.

Re: Getting fields of an object type at compile time?

2019-12-04 Thread Vindaar
You might want something like this: import macros type Foo = object a: int b: string macro getFields(x: typed): untyped = let impl = getImpl(x) let objFields = impl[2][2] # 2 is nnkObjectTy, 2 2 is nnkRecList expectKind objFields, nnkRec

Re: Getting fields of an object type at compile time?

2019-12-04 Thread SolitudeSF
https://nim-lang.github.io/Nim/iterators.html#fieldPairs.i%2CT

Re: Getting fields of an object type at compile time?

2019-12-04 Thread pmags
@SolitudeSF \-- My understanding is `fieldPairs` only works on instances of a type, not on the`` typedesc`` itself. `fieldPairs(Foo)` yields a type mismatch.

Getting fields of an object type at compile time?

2019-12-04 Thread pmags
Still on my journey to understand macros and the Nim AST... Is there an easy way to get the fields of an object type at **compile time** in a macro? Or do I need to write another macro to walk the AST myself? For example, given: type Foo = object a: int b: string

Deprecation warnings

2019-12-04 Thread Stefan_Salewski
With a fresh Nim devel I am getting Hint: glib [Processing] /home/stefan/gintrotest/tests/glib.nim(68, 13) Warning: use `csize_t` instead; csize is deprecated [Deprecated] /home/stefan/gintrotest/tests/glib.nim(69, 12) Warning: use `csize_t` instead; csize is deprecated [Dep

Re: An error has occurred when I ran `nimble publish`

2019-12-04 Thread chocobo333
Thanks for your advice. The command succeeded after updating nim.

Re: An error has occurred when I ran `nimble publish`

2019-12-04 Thread juancarlospaco
`nimble check` checks your package to see if its Ok. Run the command again. Check that you are using Nim `1.0.4`.

Re: Mix of types in division operator '/'

2019-12-04 Thread juancarlospaco
[https://github.com/Yardanico/nimpylib#nimpylib](https://github.com/Yardanico/nimpylib#nimpylib) already has that.

An error has occurred when I ran `nimble publish`

2019-12-04 Thread chocobo333
Hi. I am beginner of nim and english. I ran nimble publish Run and then an error has occurred. Pushing to remote of fork. Info Creating PR httpclient.nim(271) httpError Error: unhandled exception: Connection was closed before ful

Re: Mix of types in division operator '/'

2019-12-04 Thread Araq
So learn some Nim before complaining: template `//`(a, b: untyped) : untyped = a div b Run I couldn't copy Python's design because back then Python only had `/` and it sucked so I had to copy a different design.

Re: Any possibility of a near term Lazarus/C#-like GUI-designer IDE?

2019-12-04 Thread Araq
Ok, please ignore what I said. :D

Re: Any possibility of a near term Lazarus/C#-like GUI-designer IDE?

2019-12-04 Thread juancarlospaco
Theres UI Builder. NimQML can use the tools for Qt5 too. I recently try all the most popular GUI libs on Nimble, they all had updates <1 year, they all work and compile a Hello World or Example GUI provided. NimX is great is fast and compiles to lots of platforms, has a YAML like DSL, GPU rende

Re: Godot and Blender

2019-12-04 Thread juancarlospaco
I tried the Nim Godot bindings and they compiled like >=2 month ago. Blender uses Python so using it from Nim should be doable with Nimpy.

Re: {.gcsafe.}, What does {.threadvar.} do to make a function gcsafe?

2019-12-04 Thread mp035
Thank you, that explanation makes sense regarding {.threadvar.} however I am now confused as to why I need to worry about it at all. I am using **async** http server which I am assuming is concurrent (single threaded), so everything should be running in the same thread. This would explain why th

Re: Any possibility of a near term Lazarus/C#-like GUI-designer IDE?

2019-12-04 Thread Stefan_Salewski
> Nim-based Delphi-like IDE? There is [https://github.com/ba0f3/uibuilder.nim](https://github.com/ba0f3/uibuilder.nim) \-- but I am not sure what it really is about and it seems its author has retired. And you can of course use [https://glade.gnome.org](https://glade.gnome.org)/ to build GTK

Re: Advent of Nim 2019 megathread

2019-12-04 Thread me7
First year of AoC and first year of Nim too. Each part I usually take 2 hours so I need dedicate 4 hours each day to finish it. [https://github.com/me7/AdventOfCode](https://github.com/me7/AdventOfCode) Looking at other people code once I've done it is my favorite part. I've learn what's my mis

Re: {.gcsafe.}, What does {.threadvar.} do to make a function gcsafe?

2019-12-04 Thread kidandcat
The Threadvar pragma, as its name explains, marks the variable as a thread variable, then each thread you create will have its own copy of that variable, thus, even if you error has dissapeared, you will find that if you modify that variable in your thread A, and you then read it in your thread

Re: Godot and Blender

2019-12-04 Thread kidandcat
There are existing bindings (maybe they are outdated) [https://github.com/pragmagic/godot-nim](https://github.com/pragmagic/godot-nim)

Re: Any possibility of a near term Lazarus/C#-like GUI-designer IDE?

2019-12-04 Thread Araq
We had example code showing how to import the produced object files into a Lazarus project, this code later got removed as we have to ensure our examples continue to work. ;-) But it's definitely possible to do that but then you have the usual problems of mixing languages: FPC's strings are not

Re: Godot and Blender

2019-12-04 Thread Hendrik
Hey awesome didn't know that about Godot! I will ask them maybe someone would be interested thanks for the reply.

{.gcsafe.}, What does {.threadvar.} do to make a function gcsafe?

2019-12-04 Thread mp035
Hi, I'm working with asynchttpserver and I found that I can not access global variables from within the server callback. This seems to be because the server requires a {.gcsafe.} callback, and if a global variable (in this case a table) is accessed from within the callback it is no longer gc sa

Mix of types in division operator '/'

2019-12-04 Thread jordyscript
What is referred to here as integer division is also known as floor division. The Python language offers normal division that returns a floating point number through the / operator and integer/floor division through the // operator. I find this much more elegant, as it both leaves the div keywor