Automatically generated JS library wrappers?

2020-11-27 Thread bung
ts2nim identified the .d.ts file if the method is `TSMethodSignature` it will add `importcpp` pragma to that function.

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

2020-11-27 Thread Dan
This is very interesting topic,,bump.

Advent of Nim 2020 megathread

2020-11-27 Thread pietroppeter
If someone has not yet solved any problem yet, this might be a good time to go and solve one:

How to evaluate string in Nim's VM at runtime?

2020-11-27 Thread timothee
tests/compilerapi/tcompilerapi.nim

How to evaluate string in Nim's VM at runtime?

2020-11-27 Thread r3c
Hi, I'm writing custom ast builder, and was thinking instead of dumping the ast to file, use nim for runtime evaluation For ex. lets say we have echo(1 < 2) # true Run what I want is: echo evalDsl("1 < 2") # should output true Run Is thi

recursive iterators - is there a recommend workaround?

2020-11-27 Thread cblake
I have to say, @HJarausch, you started this thread looking for a "recommended workaround'. I feel like we gave you a pretty good, if limited, one. Now you are "moving the goalposts" (shifting criteria for 'success') towards having iterators with each & every feature of Python's just to be deemed

Advent of Nim 2020 megathread

2020-11-27 Thread hyl
If we hit the 200 limit, then I like @pietroppeter 's idea to make a year-specific leaderboard. Last year we had people who weren't actually using nim on it XD @xigoi I'm in a similar situation, and busier this year than the last one too.

recursive iterators - is there a recommend workaround?

2020-11-27 Thread Araq
Probably the alias PR from Timothee, which doesn't list the downsides and so is "very convincing". :-)

Urlly - a new library for URL parsing for C/JS backends.

2020-11-27 Thread pietroppeter
It looks very nice! My natural alternative pronunciation as an Italian would be “oo-rly” (🇮🇹urli) which means: _are you screaming?_ 😂

Automatically generated JS library wrappers?

2020-11-27 Thread Hlaaftana
I have seen multiple .d.ts to Nim translators, but I don't know if they're capable enough for most libraries. [I found this through google](https://github.com/mcclure/dts2nim) but it hasn't been worked on in 4 years, [here's another one](https://github.com/bung87/ts2nim) but I don't know if it

Urlly - a new library for URL parsing for C/JS backends.

2020-11-27 Thread treeform
Nim's standard library `uri` module does not parse query strings parameters. While `cgi` module parses the query string, but it does not work in js mode. I need to parse URLs in js mode! This led me to make a module that works everywhere C and JS and parses everything! I was not thrilled about

Automatically generated JS library wrappers?

2020-11-27 Thread moigagoo
I'm experimenting with Karax, implementing basic concepts like routing, animations, "load more," trying to find good patterns with regard to components, styling, and code organization. The next feature to implement is Google Sign-in. To make it work, I need to plug in a script that exports gaut

recursive iterators - is there a recommend workaround?

2020-11-27 Thread b3liever
Which one? please do share with us, all your concerns.

Is there any nim based 2d collision detection lib?

2020-11-27 Thread hugogranstrom
I saw this the other day, maybe it is of interest?

Is there any nim based 2d collision detection lib?

2020-11-27 Thread treeform
I was going to say I have a lib, but @hugogranstrom beat me to it! Currently is not a full physics engine, so it will not do collision response, velocity, inertia etc... but it will do collisions between polygons and circles. It will tell you fi they are over

recursive iterators - is there a recommend workaround?

2020-11-27 Thread HJarausch
Thanks for your comments. Currently I don't have enough experience in Nim - I am still learning. And since I am still convinced that iterators should upgrade from second class citizens to first class citizens in Nimland, tricky macros are not a solution. For a pull request concerning the compil

Is there any nim based 2d collision detection lib?

2020-11-27 Thread Stefan_Salewski
The RTree is some sort of rectangle overlap detection at least.

Is there any nim based 2d collision detection lib?

2020-11-27 Thread geohuz
I'm planning to use nim as a websocket client to receive realtime position message and calculate the collision detection between the predefined shapes in the area(polygons, circles). Is there any lib out there without writting binding (not familiar with c so write binding by myself is not an opt

recursive iterators - is there a recommend workaround?

2020-11-27 Thread cblake
So, I get this is example code, but your `fibonacci` has no parameters. That makes it not a very good match for a closure iterator factory proc in the first place. Maybe if it did you could do your composition "inside" `fibonacci` instead. E.g.: proc fibonacci(its = 0): iterator()

help C to nim conversion just precision

2020-11-27 Thread JPLRouge
finally we would have this lib in access with Nim that would free a lot of things

help C to nim conversion just precision

2020-11-27 Thread JPLRouge
thank Be careful, it's serious stuff I tried with the lib X11 from github Nim not bad at all but XGrabKeyboard is too penalizing even if I can detect all the keys it freezes the rest with the keyboard. but I still got the full keyboard in UTF8 whatever the language pity!!! because I have walke

help C to nim conversion just precision

2020-11-27 Thread lqdev
c2nim translates these sort of "incomplete" struct definitions into this: type TermKey* {.incompleteStruct.} = object Run You're probably running into something else in your source header.

help C to nim conversion just precision

2020-11-27 Thread JPLRouge
Hello, is it better to convert a header H or just to make links with the lib by simulating functions with proc i would like to have libtermkey for the terminal i work with linux but when i do c2nim there are instructions like typedef struct TermKey TermKey; Run which

How can I do 'fetch' or 'XMLrequest' thing in JS?

2020-11-27 Thread hrm
No idea about this coz I have been afraid of _pragma_ thing all the time. Tried compiling some procs, it works! Maybe I can stick to use this feature around. Thank you !

recursive iterators - is there a recommend workaround?

2020-11-27 Thread HJarausch
Thanks, this works nice when wrapping a for loop. But I've tried it (naively) in the follow way which fails macro toIter first type mismatch at position: 1 required type for x: ForLoopStmt but expression 'fibonacci()' is of type: iterator (): int{.closure.} Here is my example

How can I do 'fetch' or 'XMLrequest' thing in JS?

2020-11-27 Thread hrm
Thanks. I gave it a little try. For simple 'GET' fetch, it works and JS code is compact, perfectly. If I do some 'POST', the JS code starts to get fat. I don't think its extra large, but a bit messy. Any way it works. I can choose going along with this or just using karax. Thank you so much. I

Advent of Nim 2020 megathread

2020-11-27 Thread xigoi
I'm in! Unfortunately, it begins at 6:00 in my timezone (Central Europe), which will make it hard to get the tasks solved in a competitive time.

How can I do 'fetch' or 'XMLrequest' thing in JS?

2020-11-27 Thread mashingan
With importc pragma, you can write like the example here: [its type import definition](https://github.com/mashingan/nim-js-loan-calculator/blob/master/loancalculator.nim#L10-L16) , [its methods definition](https://github.com/mashingan/nim-js-loan-calculator/blob/master/loancalculator.nim#L30-L34

Ambiguous call?

2020-11-27 Thread xigoi
Alternatively, you could `import encodings except open`.

Advent of Nim 2020 megathread

2020-11-27 Thread miran
> Also it would mitigate the problem of 200 users Come on man, don't ruin my "limited availability, better be quick" marketing plan!! :D :D

Nim quiz?

2020-11-27 Thread PMunch
Hmm, nothing that I know of. But that would be very interesting to see!

How can I do 'fetch' or 'XMLrequest' thing in JS?

2020-11-27 Thread xflywind
Ref this PR

How can I do 'fetch' or 'XMLrequest' thing in JS?

2020-11-27 Thread hrm
I'm writing some helpers for my own web app, and decided to write it up with Nim JS support. And reading karax source code for finding how to fetch in Nim. I found `ajaxGET` and inside that proc, there `newRequest` has been called, but I canNot find where 'newRequet' defined. Any one could hel

Nim quiz?

2020-11-27 Thread HJarausch
Is there something like the following for Nim instead of Python? /

Advent of Nim 2020 megathread

2020-11-27 Thread pietroppeter
As usual, I will participate with enthusiasm! The repo for my solutions (also with past years) is: 🎄👑 This year I am particularly excited because I will be using a library currently in development ( _very_ pre-release) to publish the solutions:

Advent of Nim 2020 megathread

2020-11-27 Thread miran
Previous Advent of Nim threads: * [AoC 2018](https://forum.nim-lang.org/t/4416) * [AoC 2019](https://forum.nim-lang.org/t/5588)

Output AST in a recursion, using an output parameter or returning, which to prefer?

2020-11-27 Thread b3liever
Well I had a brain fart, writing a loop that merges the two Nodes was trivial.

Advent of Nim 2020 megathread

2020-11-27 Thread miran
## Advent of Code 2020 Tuesday December 1st at 5 a.m. UTC will mark the start of the sixth incarnation of [Advent of Code](https://adventofcode.com/), popular programming contest started back in 2015. The author describes Advent of Code (AoC) as " _a series of small programming puzzles for a va

Ambiguous call?

2020-11-27 Thread rgv151
You should declare f with this: f = system.open(table_path) Run

Ambiguous call?

2020-11-27 Thread matkuki
Ahhh `system`, not `io`. Thank you 👍

Ambiguous call?

2020-11-27 Thread miran
Full error message: Error: ambiguous call; both io.open(filename: string, mode: FileMode, bufSize: int) [declared in /playground/nim/lib/system/io.nim(725, 6)] and encodings.open(destEncoding: string, srcEncoding: string) [declared in /playground/nim/lib/pure/encodings.nim(306, 6)]

Ambiguous call?

2020-11-27 Thread matkuki
Hi, can somebody help me make this compile? import encodings proc parse_table(table_path: string) = var current_line: string encoder = encodings.open("UTF-8") f = open(table_path) defer: close(f) parse_table("test

Output AST in a recursion, using an output parameter or returning, which to prefer?

2020-11-27 Thread Araq
> I have two NimNodes that need to be merged and am wondering if it'd be easier > to refactor my code to use an output parameter, than any other way? I don't know about your use case, but we added `dup` to Nim for this reason: Output parameters (or more specifically: parameters with "append" sem