Tux - A good first project for learning Nim (or any language)

2020-08-12 Thread mollusk
Hey everyone, I just wanted to share a project I have been working on in between my space game. In 2016 when trying to learn the Ruby Programming Language, I wanted to create something that would teach me some basic fundamentals. I thought about what I could do and came up with writing a packag

question new symbole after compilation ??

2020-08-12 Thread jibal
> Next time please do not pollute this forum with such unimportant noise, we > have the github gintro issue tracker for that. It appears that the OP didn't know that it was a gintro issue until well into the thread.

C# nameof() in Nim

2020-08-12 Thread jibal
> Am I doing it right? I find macro programming tricky and difficult and things that seem like they should work don't, either because of a misconception or sometimes because of a compiler bug ... bang on things until they work, with plenty of test cases. Make liberal use of the debugging tools

question new symbole after compilation ??

2020-08-12 Thread Stefan_Salewski
Yes, the echo "ttt" output is unfortunately a small bug that made it into release 0.8.0. It is only debugging output for some invoked macros, so please ignore it. Unfortunately we have only 20 releases left up to 1.0, so I can not make a new release for each tiny bug. I may push fixes to github

C# nameof() in Nim

2020-08-12 Thread doongjohn
Am I doing it right? proc containsKind*(n: NimNode, k: openArray[NimNodeKind]): bool {.compileTime.} = k.contains(n.kind) macro nameofAux(x: untyped): string = if x.kind notin {nnkIdent, nnkDotExpr, nnkBracketExpr}: let msg = "'" & x.repr & "' is not vali

question new symbole after compilation ??

2020-08-12 Thread JPLRouge
I think I found, until version 0.7.7 of GINTRO I had no problem, and putting version 0.8.0 I have problems as i can't mount gtk4 and gtk3 remains 3.24.21 ! now i have reverted to version 0.7.7 message for #Stefan_Salewski

Nim website front page redesign (unofficial and WIP)

2020-08-12 Thread leorize
Maybe change the background as well? It looks random and weird, considering that Nim doesn't even have any notable syntax that use `><` "Try it online" probably can be merged with the examples (eg. make the examples editable)?

Why use range[0..255] instead of char?

2020-08-12 Thread mashingan
> Why would one limit the range of possible values for r,g and b with > range[0..255] instead of using the char type? This is a matter of representation, RGB is represented as range[0..255] to clearly indicate as such while char is, well, literally a character. I rarely use the char past of 'z'

Nim website front page redesign (unofficial and WIP)

2020-08-12 Thread doongjohn
> "Try it online" probably can be merged with the examples (eg. make the > examples editable)? That seems right. I'll do that! > It looks random and weird, ... I tried to make use of straight lines to make it look modern but yup it is random ;) Still thinking about how to make it better. A

C# nameof() in Nim

2020-08-12 Thread doongjohn
> but his language is more powerful than even he realizes. wow that's so cool lol

question new symbole after compilation ??

2020-08-12 Thread jibal
echo "ttt ", ahl Run Talk to StefanSalewski :-)

question new symbole after compilation ??

2020-08-12 Thread JPLRouge
yes gintro .

question new symbole after compilation ??

2020-08-12 Thread Yardanico
Maybe gintro does that while compiling?

question new symbole after compilation ??

2020-08-12 Thread jibal
ttt (self: Widget; event: gdk.Event): bool ttt (self: Terminal; status: int) ttt (self: Terminal; width: int; height: int) Run Perhaps a macro in your code or some library it uses is printing these?

question new symbole after compilation ??

2020-08-12 Thread Yardanico
Sorry, but I can't really understand the question - can you be more specific? Do you mean compilation output or something else? Can you paste the compilation output itself?

question new symbole after compilation ??

2020-08-12 Thread JPLRouge
hello, why i see in my compilation appear ttt after ex: new ??? ttt ttt (self: Widget; event: gdk.Event): bool I knew CC: stdlib_assertions.nim thank you

question new symbole after compilation ??

2020-08-12 Thread JPLRouge
thank you Hint: used config file '/home/soleil/.choosenim/toolchains/nim-1.2.6/config/nim.cfg' [Conf] Hint: system [Processing] Hint: repr_v2 [Processing] Hint: widestrs [Processing] Hint: io [Processing] Hint: macro01 [Processing] /home/soleil/NimScreen/macro01.nim(2, 20) Error: undeclared id

Why use range[0..255] instead of char?

2020-08-12 Thread jibal
Well, the fact that a Color is implemented as an `int` rather than a seq or array of chars is highly relevant, and that's why I pointed it out ... I wasn't just picking a nit.

C# nameof() in Nim

2020-08-12 Thread jibal
Here's another approach, with better error messages: macro nameofAux(x: untyped): string = if x.kind notin {nnkIdent, nnkDotExpr}: let msg = "'" & x.repr & "' is not valid for nameof" quote do: {.error: `msg`.} else: let name = if x.kind == nnkIdent

invocation of external compiler program failed. The system cannot find the file specified

2020-08-12 Thread Tuatarian
I installed mingw in the dist folder (using finish.exe, did not work if I didn't run as administrator, with admin rights) in my nim installation and it works! thank you!

C# nameof() in Nim

2020-08-12 Thread jibal
> Use untyped instead of typed, that will get you the template. The problem with that is that the whole point of using `nameof(foo)` in place of just "foo" is to typecheck `foo` to make sure that it is defined. As a former C#/WPF programmer, I'm aware of this and would not expect anyone else to

C# nameof() in Nim

2020-08-12 Thread jibal
Pardon that previous message ... I wasn't paying attention. Try this: import macros macro checkDefined(name: untyped, x: typed): string = return name.toStrLit macro nameof(x: untyped): string = var name = x if name.kind != nnkIdent: x.expect

Improving Nim for Beginners video series's AUDIO

2020-08-12 Thread Kiloneie
I do use OBS, i have already tweaked it very hard so that absolutely no background noise is caught and the quality is good, but sadly my mouse in like a hand palm and a half away from my mouse, and like 3-4 from my keyboard, my keyboard is just too loud. I haven't found any setting for filtering

C# nameof() in Nim

2020-08-12 Thread jibal
Try this: macro nameof(x: typed): string = var x = x if x.kind != nnkSym: x.expectKind(nnkDotExpr) x = x[^1] newLit(x.strVal) let a = (b: (c: 1)) type foo[T] = tuple[x: T] echo nameof(a) # "a" echo nameof(a.b.c) # "c" ech

Improving Nim for Beginners video series's AUDIO

2020-08-12 Thread juancarlospaco
What do you use to record?, OBS Studio has settings to improve all of this sound/noise related stuff. :)

Why use range[0..255] instead of char?

2020-08-12 Thread digitalcraftsman
Thanks for your feedback @jibal. > The aforementioned rgb proc's return type is range[0..255]. No, its return > type is Color (which is represented internally as an int). I actually meant the data type of the proc's arguments. I've corrected my last comment accordingly.

Improving Nim for Beginners video series's AUDIO

2020-08-12 Thread hugogranstrom
I agree with @lum, I think it has a nice sound to it when you click the keyboard. So lowering it a bit (option 1) is my preference

Improving Nim for Beginners video series's AUDIO

2020-08-12 Thread lum
Hi. **Personally** , mouse clicks or keyboard sounds do not interfere with me in any way. **In my opinion** , they even make the video more realistic. But if I need to choose from 3 options, I prefer 1.

Why use range[0..255] instead of char?

2020-08-12 Thread jibal
`scan.data` is a `seq[T]`, where in this case `T` is `char`. The designer chose to encode `RGBA8` values as `char`, but `RGBA16` values are encoded as `uint16`. That's a mismatch ... the latter makes sense, the former not so much. But this poor design choice is certainly not a reason to make``co

how to change the `op` argument for macros.quote

2020-08-12 Thread jibal
> You can't change it, because `` is a syntax feature Um, no, it's simply a bug ... did you read the documentation for `quote`? See semQuoteAst in semExprs.nim ... `if n.len == 3: expectString(c, n[1])` should be `if n.len == 3: expectString(c, n[2])`

Why use range[0..255] instead of char?

2020-08-12 Thread digitalcraftsman
To provide a bit more context: for a little project im using the [nimPNG](https://github.com/jangko/nimPNG) module, more spefically it's [loadPNG24](https://github.com/jangko/nimPNG/blob/89c433f1a19e71b359380ed17b43e1a395e34e40/nimPNG.nim#L1933) proc. With the following snippet one can see that

Nim website front page redesign (unofficial and WIP)

2020-08-12 Thread Kiloneie
I would say yes use this design, except for the part that all that white is burning my eyes out D:... Please dark mode.

Improving Nim for Beginners video series's AUDIO

2020-08-12 Thread Kiloneie
Since my #1 video of my Nim for Beginners video series i have been trying to resolve my audio issues, at first the volume and quality. Now all of that has been fixed and i have also lowered the volume of my obnoxiously loud mechanical keyboard, but still it remains at large (Don't ask me to fix

Why use range[0..255] instead of char?

2020-08-12 Thread jibal
RGB values simply aren't characters. The fact that they happen to have the same range is coincidental--e.g., if ints were 64 bits when the ARGB standard was defined, the values might have been int16 instead of int8. Using char instead of [0..255] is all kinds of wrong conceptually. I once got a

how to pass multiple parameters into proc - not varargs

2020-08-12 Thread jibal
> I've been hammering at it for... days Then it would be a good idea to show some of that work, to give us a better sense of what you're trying to achieve and how you're thinking about it.

play.nim-lang.org has been down for several hours

2020-08-12 Thread gabbhack
:(

invocation of external compiler program failed. The system cannot find the file specified

2020-08-12 Thread Stefan_Salewski
You did not tell us how you installed the Nim compiler. On the Windows install page [https://nim-lang.org/install_windows.html](https://nim-lang.org/install_windows.html) there is the note: > The zip file includes a simple application called finish.exe that can attempt > to Have you executed

Nim website front page redesign (unofficial and WIP)

2020-08-12 Thread federico3
I miss the original style e.g. [https://web.archive.org/web/20150217215322/http://nim-lang.org](https://web.archive.org/web/20150217215322/http://nim-lang.org)/ \- it had its personality.

Nim website front page redesign (unofficial and WIP)

2020-08-12 Thread dom96
Random thought: maybe we should put this design on [https://lite.nim-lang.org](https://lite.nim-lang.org)? (or landing.nim-lang.org or if someone has a better idea...) :)

HTTPS requests in Nim

2020-08-12 Thread lum
Thank you! Installing via choosenim helped me

HTTPS requests in Nim

2020-08-12 Thread lum
Hi. I was looking for the library for **HTTPS** requests(like requests in Python). I found standart **httpClient**. But when I did request to **https: //github.com/** and compile my programm with **-d:ssl** I caught this error: not load: (libcrypto-1_1-x64|libeay64).dll R

HTTPS requests in Nim

2020-08-12 Thread gabbhack
Check Other dependencies on [https://nim-lang.org/install_windows.html](https://nim-lang.org/install_windows.html) or install nim via choosenim

how to pass multiple parameters into proc - not varargs

2020-08-12 Thread Stefan_Salewski
The Hlaaftana suggestion seems to be compile time... For a dynamic runtime solution it may be better to have procs that accepts not many parameters but an object like type InitData = object name: string age: int proc newPerson(d: initData): Person = #

invocation of external compiler program failed. The system cannot find the file specified

2020-08-12 Thread Tuatarian
This happens with any script I run, even something like 1 | echo "Hello World". Don't know why Full error message: Error: invocation of external compiler program failed. The system cannot find the file specified. Additional info: "Requested command not found: 'gcc.exe -c -w -mno-ms-bitfields -I