Re: Can I nest template?

2019-10-08 Thread jasper
Nesting templates is fine. The problem is `myFunc.inner` instead of `inner(myFunc)`. For templates it best to use the call `foo(a, b, c)`, or command `foo a, b, c` syntax. See:

Re: Can I nest template?

2019-10-08 Thread xflywind
It is helpful! Thank you so very much!

Can I nest template?

2019-10-08 Thread xflywind
I'm a beginer.And I'm writing some code to measure the execution times of proc. However, when I nest template, I get some error **Error: expression 'mySleep([1, 2, 3])' has no type (or is ambiguous).** code in -> [https://play.nim-lang.org/#ix=1Y5M](https://play.nim-lang.org/#ix=1Y5M) . Namely

Re: Any tutorials for compiling to JavaScript (specifically DOM)?

2019-10-08 Thread GordonBGood
@dotheda: > Also, I would do WebAssembly but the process seems a lot more complicated, so > I'll wait until it gets proper support, official or not. Any news on that? I don't know about official support, but it has been done often enough, even by @Araq, although many users are on Linux and

Nimble Mac crashes - possibly after 1.0 brew release

2019-10-08 Thread tcab
Nimble is crashing when trying to update itself, or when installing packages. It used to work fine, but seems to have broken after I updated to Nim 1.0 using brew on Mac. I’ve put more detail in a comment to an existing similar nimble issue

Re: Using `{.gcsafe.}` on a global string

2019-10-08 Thread sschwarzer
I suppose the reason why I might want to override the compiler's analysis would probably _not_ be that I want to "risk it" despite GC-unsafe code. I'd use the pragma because there are - hopefully - clear rules what is GC-safe and what isn't and I'd want to override the compiler in case the code

Re: Using the JS Backend as transpiler

2019-10-08 Thread r3c
@Araq my intent is to output more readable and debbugable code. Im currently looking at **jsgen.nim** Lets say I want to make a new backend target - Typescript The resulting code shoud look like this: const msg:string = "TS Backend"; for(i = 0; i<=10 ; i++) {

UI This package wraps the libui obsolete

2019-10-08 Thread JPLRouge
hello compile [https://github.com/nim-lang/ui/blob/master/examples/table.nim](https://github.com/nim-lang/ui/blob/master/examples/table.nim) /home/soleil/snap/code/common/.cache/nim/table_r/table.nim.c:294:1: warning: type of ‘uiTableValueInt’ does not match original declaration

Re: How to use Postgres with Nim on Windows - problems with drivers

2019-10-08 Thread siloamx
I've got could not load: libpq.dll Run however libpg.dll is in the app directory.

Re: Nim for Beginners Video Series

2019-10-08 Thread torarinvik
I I like it just they way it is. But as a recording enthuisiast, the easiest way to get rid of the typing and backround noise is to buy a cheap lavalier mic and put it close to your mouth and maybe use a compressor and maybe a noise gate. But as I said, I think your videos are excellent they

Re: Nim Coding Examples and Exercises for beginners?

2019-10-08 Thread torarinvik
The chess game looks awesome. Impressive stuff for such a small amount of code. Is it just me or do Nim create really compact code? I would imagine C++ with the libraries might require more. When that is said, the chess game is a little too advanced for me at this moment. But I might try it a

Re: Nim Coding Examples and Exercises for beginners?

2019-10-08 Thread Stefan_Salewski
Funny, I did a chess game too some years ago. [https://github.com/StefanSalewski/nim-chess4](https://github.com/StefanSalewski/nim-chess4)

Re: Nim Coding Examples and Exercises for beginners?

2019-10-08 Thread dawkot
Maybe my [chess game](https://github.com/dawkot/netchess) will be helpful. The rules are in src/game.nim and should on all targets.

Re: Nim for Beginners Video Series

2019-10-08 Thread Kiloneie
I know my voice is a bit low, i talk quietly and i had to lower the volume to drop background noise, might tweak it some to improve it. About the keyboard part... some people like it D: ... idk. I could try to normalize the volumes in the editing, maybe that will fix the high volume of my

Re: Nim Coding Examples and Exercises for beginners?

2019-10-08 Thread torarinvik
I tried that game but it gives me error. It says newGame is not declared. I don't see any myself. I did "import ui" on top of project. proc gui*() = var mainwin = newWindow("tictactoe", 400, 500, true) # game object to contain the state, the players, the difficulty,... var g =

Re: Nim Coding Examples and Exercises for beginners?

2019-10-08 Thread miran
For Tic Tac Toe (and maybe some other interesting small projects): take a look at "Nim Days" [https://xmonader.github.io/nimdays](https://xmonader.github.io/nimdays)/

Nim Coding Examples and Exercises for beginners?

2019-10-08 Thread torarinvik
Hi I need some help with tips to write some beginner level programs in Nim. I wonder if you have examples of some simple projects I can do to improve my coding skills? I am very interested in things like Tic Tac Toe game, Snake game or any kind of cool, interesting or rewarding projects that is

Re: Nim for Beginners Video Series

2019-10-08 Thread torarinvik
These videos are amazing. The number one thing for me when choosing what languages to learn is the amount and quality of teaching material, and how helpful the community of the language has. These videos are so well paced and well explained that almost anyone can learn it. In my experience with

Re: Using `{.gcsafe.}` on a global string

2019-10-08 Thread dawkot
Well, the entire point of the pragma is, according to the manual: `To override the compiler's gcsafety analysis a {.gcsafe.} pragma block can be used`

Re: Trying to make dict in dict (table in table)

2019-10-08 Thread dawkot
You're supposed to either have Server be a ref object for it to have reference semantics or use it as a [var parameter](https://nim-lang.org/docs/manual.html#procedures-var-parameters)

Re: Nim for Beginners Video Series

2019-10-08 Thread ducdetronquito
Hello @Kiloneie ! First really nice job, keep going there is not much of these Nim tutorials out there ! My only advice would be to make your voice more clear. Right now, your voice is a bit low and the sound of you hitting your keys is a bit loud. Maybe you could first record the video and

Re: multi-platform time tracker with ML use

2019-10-08 Thread mratsim
For OCR you will need OpenCV compiled with Tesseract support. See tutorial here, especially using the C++ API:

Re: Trying to make dict in dict (table in table)

2019-10-08 Thread vbxx3
import net import strutils import tables import asynchttpserver, asyncdispatch type Server* = object port: int routes: Table[string, Table[string, proc(request: Request) {.cdecl.}]] allowedMethods: seq[string] proc newServer*: Server =

Re: Trying to make dict in dict (table in table)

2019-10-08 Thread vbxx3
Hi! httpMethod is string here

Re: Using `{.gcsafe.}` on a global string

2019-10-08 Thread sschwarzer
Re 1.: How would I be able to tell whether the code is safe in the future? Will there be a new definition of "GC-safe" at some point or was my understanding of GC safety wrong to begin with?

Re: Trying to make dict in dict (table in table)

2019-10-08 Thread Araq
This compiles: import tables, asynchttpserver type Server* = object port: int routes: Table[string, Table[string, proc(request: Request) {.cdecl.}]] allowedMethods: seq[string] proc newServer*: Server = result.port = 8080

Re: Using `{.gcsafe.}` on a global string

2019-10-08 Thread sschwarzer
Thanks for your answers and the code suggestion. I see what you're doing here, but I need the same temporary directory for all threads. :-) Would the approach with `deepcopy` [as in the manual](https://nim-lang.org/docs/manual.html#threads-gc-safety) be safe? import os import

Entertainment with trends now GamesBX for more colorful life.

2019-10-08 Thread GamesBXdaily
Hello everybody, Online games address common entertainment needs with convenience.With GamesBX, you can play games anytime, anywhere and on any internet-connected device, even when you're on the go. From listless people to people in the waiting room. Players can choose from a variety of

Re: Trying to make dict in dict (table in table)

2019-10-08 Thread ducdetronquito
Hi @vbxx3 ! What is the type of httpMethod in the addRoute* method ? You haven't defined it in the method definition.

Re: Nim for Beginners Video Series

2019-10-08 Thread dponyatov
Wow, great job! It is not so attractive for someone who makes a lot of stuff for beginners, comparing to advanced topics, but please continue -- going step by step with video is very important for beginners to dive into the topic (Nim programming). Your video series can make the Nim as the

Re: Using the JS Backend as transpiler

2019-10-08 Thread Araq
Specialize `system.echo` for a single string/cstring argument. But it seems foolish, `echo` or `console.log` shouldn't be on your critical path.