The secret of Nim

2023-09-25 Thread foldl
How is `editing` defined? If it is allowed to pick a specific pixel and place it elsewhere, then, two pixels are enough to _recover_ the crown.

Quantum Leaps framework implementation /Miro Samek/

2023-09-25 Thread rad
Glad to see there is interest in Samek's work. Reading his book was a revelation to me. It was the first time I had seen a framework described that could manage complex systems with rather simple ideas. No threading or operating system required. It was a tough read for me because I have hard ti

Simple template and macro question

2023-09-25 Thread CircArgs
Thanks all @PMunch , choltreppe, and @nrk! @nrk I'd seen those docs, but I couldn't see why even the proc parameters would be gensym'd. Is there a way to actually see the expanded Nim code. Like your comment: # works, as it expands to something like: # let x`gensym0 = "hello wo

High level TUI framework (or wrapper of)

2023-09-25 Thread Araq
Good luck.

High level TUI framework (or wrapper of)

2023-09-25 Thread void09
Well, I decided I will learn rust and attempt my project there. Nim ecosystem (libs and potential manpower, as well as velocity of growth) too sparse for the job unfortunately. And also because my poor coding speed and knowledge can't make up for the lacking ecosystem. Will still use Nim for sim

for loop iteration variables

2023-09-25 Thread Araq
Nim started with doing the right thing but we changed it to the wrong thing so that JS interop becomes easier and in order to speed up callback-heavy code (cough `async`).

atlas/nimble build still tries to download dependencies despite nim.cfg

2023-09-25 Thread Araq
Ah! Great point, will rename that command.

for loop iteration variables

2023-09-25 Thread treeform
What are pros and cons of altering the Nim language to always capture the for loop variable like go did? Will it make code that much slower? Most of the time capture for loop variable does not matter and should not impact performance?

atlas/nimble build still tries to download dependencies despite nim.cfg

2023-09-25 Thread woolsweater
> What's the benefit of nimble build when you use Atlas to manage your deps? Well, I started out trying `atlas build` but of course that is currently an alias for `nimble build`. If the intended process for now is to just use `nim c` then I think that resolves my question, thanks!

atlas/nimble build still tries to download dependencies despite nim.cfg

2023-09-25 Thread sOkam
`nimble build` provides some form of buildsystem management that's easy to setup and use. Which atlas doesn't provide, because it relies on `nim c ...` instead. But that is not mentioned anywhere, and there is also no guide on how to transition from one to the other. So, even though there might

atlas/nimble build still tries to download dependencies despite nim.cfg

2023-09-25 Thread Araq
Now import malebolgia in your Nim code and run the compiler as usual: echo "import malebolgia" >myproject.nim nim c myproject.nim Run

for loop iteration variables

2023-09-25 Thread Difget
Great job on converting the Go code to Nim! To modify the Nim code so that it prints 1, 2, 3, you can capture the value of i for each iteration using a temporary variable. Here's the modified code: nim Copy code var prints: seq[proc ()] = @[] for i in 1..3: let tmp = i prints.add(proc () =

Improving Examples and Documentation

2023-09-25 Thread ingo
> I don't know where this aversion to writing documentation comes from. "Read the source, Luke!". :(

Improving Examples and Documentation

2023-09-25 Thread Araq
> but nothing that forms a coherent guide like K&R C does It's easier to describe a language released in 1980 than one released in 2010+ after 30-40 years of technological progress and growing user expectations. > There are chapters on mastering macros and parallelism, I have not yet made > it

Simple template and macro question

2023-09-25 Thread choltreppe
> In general, variables & types are gensym'ed, procedures and the like are > inject'ed. This is why you can call add without an inject pragma. This is not the reason. The symbol is inject because `name` is a parameter of the template. But it would also be injected if it wasn't because its a proc

Improving Examples and Documentation

2023-09-25 Thread HiPhish
Where? I am 100 pages in and it's still a reference manual (aside from the first part of course, but that's just about 30 pages). Yes, there are examples and explanation, but nothing that forms a coherent guide like K&R C does. There are chapters on mastering macros and parallelism, I have not y

Simple template and macro question

2023-09-25 Thread PMunch
What @nrk says is completely correct. But just for completeness sake I have some additional comments. By default symbols are gensym'ed, meaning they get non-colliding names. But we can explicitly name the arguments like so: macro createProc(name: untyped, body: untyped): untyped =