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
> 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.
> 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
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
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
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
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 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'
> "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
> but his language is more powerful than even he realizes.
wow that's so cool lol
echo "ttt ", ahl
Run
Talk to StefanSalewski :-)
yes gintro .
Maybe gintro does that while compiling?
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?
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?
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
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
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.
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
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!
> 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
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
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
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
What do you use to record?, OBS Studio has settings to improve all of this
sound/noise related stuff. :)
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.
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
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.
`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
> 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])`
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
I would say yes use this design, except for the part that all that white is
burning my eyes out D:... Please dark mode.
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
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
> 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.
:(
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
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.
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...) :)
Thank you! Installing via choosenim helped me
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
Check Other dependencies on
[https://nim-lang.org/install_windows.html](https://nim-lang.org/install_windows.html)
or install nim via choosenim
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 =
#
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
44 matches
Mail list logo