two data bindings in vanilla nim for js app without virtual DOM

2022-03-26 Thread domogled
Karax is an amazing framework. But the virtual house is overhead, says author Svelte. I'm researching how Svelte works. It's a compiler. The `nim js` command is also a compiler, isn't it? I'm trying to use "vanilla nim" instead. The first thing I need is two data binding. How is it done? I fou

Can't have correct Nim nested template. Please explain

2022-03-26 Thread Araq
import parsexml # Throw away your code and use a real parser. Run

Can't have correct Nim nested template. Please explain

2022-03-26 Thread mardiyah
felt firstly bothering everyone to ask help for the actual code, but having no choice, so the error is on public: line 151 template getE_MultiN( ret :var seq[array[2,string]]; nodOffset, nod, tag, posn, att :stri

Can't have correct Nim nested template. Please explain

2022-03-26 Thread mardiyah
that's actually of the actual case giving firstly error out of memory Error: execution of an external program failed: Run the actual case actually having more complexity so made simple as the post

Can't have correct Nim nested template. Please explain

2022-03-26 Thread Yardanico
If you get "out of memory" when the program is executing, it either means that your program is actually running out of memory or it's trying to do something bad with pointers and stuff. The code you provided can't result in behaviour like that, so we'll need the whole source code to be able to

Can't have correct Nim nested template. Please explain

2022-03-26 Thread mardiyah
that's actually of the actual case giving firstly error of memory Error: execution of an external program failed: Run the actual case giving actually having more complexity

Can't have correct Nim nested template. Please explain

2022-03-26 Thread Yardanico
Or, with the `{.dirty.}` pragma: template f {.dirty.} = i += 5 template g = var i: int if true: f else: i += 2 echo "\ni=", i Run But yes, @sky_khan's solution is cleaner.

Can't have correct Nim nested template. Please explain

2022-03-26 Thread sky_khan
template f(i:int)= i += 5 template g= var i : int if true: f(i) else: i += 2 echo "\ni=",i g Run

Can't have correct Nim nested template. Please explain

2022-03-26 Thread mardiyah
Help out solve correct `i` template f= i += 5 template g= var i : int if true: f else: i += 2 echo "\ni=",i Run it'll fail in many ways, one e.g. is: `Error: undeclared identifier: 'i'`

CSV file parsing

2022-03-26 Thread Stefan_Salewski
As noted in the other thread, with -d:useMalloc we can fix the issue for --gc:arc and get runtimes of about 120 ms, equal to refc. But for --gc:orc -d:useMalloc does not help that much. For the initial code version, and the code from above with splitlines() replaced by parseUntil, I get runtime

CSV file parsing

2022-03-26 Thread Stefan_Salewski
Funny fact, this user observed the same factor 5 slowdown for ARC:

Excuse me, how to hide the console window of the program?

2022-03-26 Thread luyimoon
thanks

Excuse me, how to loop and output each character of the Chinese string?

2022-03-26 Thread luyimoon
Excuse me, how to loop and output each character of the Chinese string?

Excuse me, how to loop and output each character of the Chinese string?

2022-03-26 Thread luyimoon
thanks

Excuse me, how to loop and output each character of the Chinese string?

2022-03-26 Thread DavideGalilei
Via `std / unicode`'s `runes` iterator. import std / unicode let s = "你好世界!" for rune in runes(s): echo "Character: ", rune Run Output: `Character: 你 Character: 好 Character: 世 Character: 界 Character: !`

CSV file parsing

2022-03-26 Thread Stefan_Salewski
Thinking about it, I am just wondering if iterators that are returning strings have to do an allocation for each yield? As strings in Nim have value semantics, one single initial allocation may be enough? Or maybe I am wrong. Looking at

CSV file parsing

2022-03-26 Thread Stefan_Salewski
Yes, removing splitLines() helps a lot, runtime is now down to 100 ms. So I can let that section in the book. Question is still why it is so slow with splitLines() and ARC. New code is something like # nim c --threads:on --gc:arc -d:release t.nim import std/threadpool

CSV file parsing

2022-03-26 Thread Stefan_Salewski
> Unfortunately I do not really understand the large performance difference of > the last parallel example for default GC and ARC/ORC. That was my only question. I hide it a bit, for good reasons :-). Most of your other remarks seems to be true, I mentioned some of the points in my text already