What are drawbacks of using forward declarations with "include" as a "module interface"-mechanism?

2023-11-09 Thread Isofruit
Interestingly enough often times I don't actually need a concept in any capacity, it's that the same operation on an identical type is supposed to be performed in N different ways. Example: Password hashing. The type you operate on is always `type Password = distinct string`. However _how_ you

Open-source Nim projects that beginners can contribute to

2023-11-09 Thread Isofruit
Nim itself. I'm not kidding. You don't need to contribute code or anything, just recall if any of the modules you use contained all the details you would've liked to have available when you read them. If they didn't, well you can pretty easily add to them. There's an "Edit" button under every p

Open-source Nim projects that beginners can contribute to

2023-11-09 Thread jasonfi
Nexus is a full-stack Nim web framework: However I mostly use the ORM when I use it in projects. I have ideas on how to improve the project, but not enough time these days.

Open-source Nim projects that beginners can contribute to

2023-11-09 Thread bsljth
Kindly suggest some open-source Nim projects that beginners can contribute to. I have about 2 years knowledge as a JavaScript programmer and an avid reader. I got into Nim a couple of months back. I wrote a tiny library called [printo](https://github.com/bsljth/printo) with Nim. I am looking fo

Compile to NIM to WASM with the Wasi-SDK

2023-11-09 Thread ElegantBeef
You likely should use `--os:linux --cpu:wasm32`

is jester now working well with nim version 2

2023-11-09 Thread jasonfi
Jester worked fine in Nim v1, at least with the versions I tested. All you have to do is run `nimble install jester` and then write your web app with it.

What are drawbacks of using forward declarations with "include" as a "module interface"-mechanism?

2023-11-09 Thread Araq
The reason why we don't use it for `os.nim` etc is that it doesn't work well with Nim's effect system. In addition to that, you cannot forward declare iterators, templates and macros. But yes, the idea has plenty of merit.

how to feed stdin to external process and redirect stdout ?

2023-11-09 Thread janAkali
`discard process.waitForExit` indeed waits for program to exit, but stockfish doesn't exit after the last command, it merely waits for another. `waitForExit()` is useful for programs that fire once and exit when they're finished, like for example `sleep` or `grep`. You can test how stockfish be

Github action to build documentation

2023-11-09 Thread amadan
Very possible and something I want to do. My two current ideas are * Using action cache: This is the least hacky method, but since the archives expire it means you'd need to do a full documentation rebuild if you come back to a project after a while. * Store a compressed version of the site

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread didlybom
That’s really cool to hear! I didn’t know that NIR was supposed to improve the performance of nim in addition to all its other benefits!

What are drawbacks of using forward declarations with "include" as a "module interface"-mechanism?

2023-11-09 Thread PMunch
I would assume that the problem lies in how this is validated for a type. Say you want to create an interface, it typically needs the concept of a `self` parameter which is the type that "owns" the implementation. This would traditionally be the class which implements the interface. So how do yo

how to feed stdin to external process and redirect stdout ?

2023-11-09 Thread tissatussa
i found a solution at and i created this script, which works ! import osproc, streams let process = startProcess("stockfish", args = [], options = {poUsePath}) let (fromp, top) = (process.outputStream,

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread Isofruit
But Araq, what if the butter is coming straight out of liquid nitrogen?

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread Araq
sequtils is not slow per se, once NIR arrives its optimizer will cut through it like butter.

What are drawbacks of using forward declarations with "include" as a "module interface"-mechanism?

2023-11-09 Thread Isofruit
This occurred to me a couple weeks back but I honestly couldn't see much of a drawback, so I got curious about how it is seen by others. Theoretically speaking, you can use forward declarations to force a module to implement a proc. So this is possible: #moduleInterface.nim pr

Compile to NIM to WASM with the Wasi-SDK

2023-11-09 Thread niltempus
Also, how do I fix the typo in my thread title?

Compile to NIM to WASM with the Wasi-SDK

2023-11-09 Thread niltempus
Hello, Has anyone successfully used the clang compiler in the wasi-sdk to compile Nim directly to wasm? I tried this command on Windows 10: nim c --os:any -d:useMalloc --cc:env .hello.nim I'm getting "NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "Pointer size

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread didlybom
I don't disagree with you, in almost all cases this should not matter. I'd just like to be able to tell whether I am accidentally introducing some allocation deep inside a nested loop or something like that, for example. In a way it'd be more to learn how nim works than anything else. The syntax

B Extra Capsules UK:- Official Website, Buying, (Scam Alert) Online Sale Product

2023-11-09 Thread coreyjsanders
B Extra Capsules UK:- According to a 2019 study published on Int J Mol Sci, Psyllium Husk helps promote regular bowel movements, improve digestion, and support a healthy gut. Additionally, it creates a feeling of fullness, which can aid in appetite control and prevent overeating. Official Faceb

nimble install error wanted ... got -1

2023-11-09 Thread michaelplotke
The mismatch was not the cause of the issue. It manifested also given the version `== 1.3.1`. I used `atlas` but found it complicated beyond what I wanted to learn in the moment. Instead I deleted `~/.nimble` and re-ran `nimble install` to resolve the issue.

nimble install error wanted ... got -1

2023-11-09 Thread geotre
There was a mismatch between the version number in the git tag and the version number in the nimble file. Not sure if that was causing the issue. I have just pushed v1.3.3 with the correct nimble file/tag

nimble install error wanted ... got -1

2023-11-09 Thread Araq
I've never seen this error before. As a workaround try `atlas init && atlas use karax`

Using the compiler API for hot code reloading

2023-11-09 Thread Gael
You can use the system module to capture the standard output and standard error streams when evaluating the script with evalScript. This way, you can check if there are any errors in the standard error output and handle them in your code. Here's an example of how you can modify your code to achi

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread Araq
This keeps coming up and I keep saying no. It's just a bad idea, it's 2023, embedded devices have more RAM than the PC level machines I learned to program on and allocation/deallocation is O(1) in Nim. If you want speed, use a profiler, if you care about fragmentation, use tools to show you frag

nimble install error wanted ... got -1

2023-11-09 Thread michaelplotke
I have a new nimble project. In the `.nimble` file I have the following require. requires "karax >= 1.3.2" Run When I attempt to `nimble install` I get the following error during the `karax` installation. Error: Downloaded package's version does not sati

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread didlybom
Thank you again Araq. That's clear now. Is there some way to print the memory allocations that are introduced in some block of code at compilation time? I know about the --expandArc flag but is there something simpler? Or perhaps, could a macro be created that caused compilation to fail if any

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread Araq
Yes, it will copy. The copy is subject to "Nim's cursor optimizer" so it can be eliminated. You can also ask for it explicitly: let arg {.cursor.} = arg Run However, in your more complex example not even that can work as a cursor doesn't own its data but your `arg & n

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread didlybom
Actually, I have an additional question. Can that pattern result in an unnecessary copy when used with seqs, for example?: proc myFunc(arg: seq[int]) = let arg = arg Run Will this result in a copy? This is obviously a super silly example, but imagine a slightly

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread didlybom
Thank you Araq. I'll keep using doing it this way then.

https://facebook.com/BExtraWeightLossPillUK

2023-11-09 Thread barrysalejos
Facebook Page:- B-Extra Weightloss Pills UK:- B-Extra Weightloss Pills UK is an B Extra Weight Loss Capsules that specialists and dieticians firmly suggest. This is accessible at this cost as a feature of a unique arrangement, so it won't be an extr

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread dissolved_girl
I never really have this problem since I either operate on `result` or create local variables with names that represent my values more accurately. For example, your code could be rewritten as: proc myFunc(arg: int): int = result = 2*arg let x = 10 echo myFunc(x)

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread Araq
The right way is to re-use the name as that prevents you from accidentically using the old version of the value.

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread PMunch
I do the same thing when the need arises. If anything I think this is the best style, you make it obvious that you're mutating a local copy. And by giving it the same name you not only make it easier to track the variable through the file, but it also makes it harder to unwittingly use the wrong

Modifying the value of a procedure argument (without making the input argument var)

2023-11-09 Thread didlybom
I often find myself wanting to modify a local copy of an argument without modifying the value that was passed to the function. In python this is trivial. For example: def myFunc(arg): arg = 2*arg print(arg) x = 10 myFunc(x) print(x) Run Whi