Re: Nim Cheatsheet PDF (English+Spanish+Latex)

2020-05-28 Thread siloamx
Great idea! Thanks.

Re: Stream IO errors with -d:release flag

2020-05-28 Thread seves
Thank you for your answers. I appreciate that very much. Its a bit funny but i don't use c in this context. The problem I have is that it didn't work with the flag -d: release. I have now tried something out and found out the following: When I create the stream from the previously opened file,

Re: VSCode debug: strings and booleans are ugly

2020-05-28 Thread Yardanico
Sometimes you really want an interactive debugger though

Re: Faster and Safer Raytracing in Nim

2020-05-28 Thread mratsim
> How about to use counter based random number generater like philox? > [https://www.thesalmons.org/john/random123](https://www.thesalmons.org/john/random123)/ This paper is mentioned in JAX (another Google Deep Learning framework), which was mentioned to me here [https://github.com/mratsim/wea

Re: Doc generation fails

2020-05-28 Thread kaushalmodi
This issue is now fixed on devel, but there's another regression with `nim doc` \+ `runnableExamples`: [https://github.com/nim-lang/Nim/issues/14485](https://github.com/nim-lang/Nim/issues/14485) .

Git mirror for nimble packages https://reg.nim.moe/

2020-05-28 Thread lmariscal
Hi, I shared this on IRC a month ago, but wanted to share it here too after it has been running non-stop for a month. **What is it?** This is mostly a cron job that clones all the Git and Mercurial repositories and offers them through a modified package registry. What I'm trying to accomplish

Re: Faster and Safer Raytracing in Nim

2020-05-28 Thread demotomohiro
How about to use counter based random number generater like philox? [https://www.thesalmons.org/john/random123](https://www.thesalmons.org/john/random123)/ It works like a hash function. When you generate a random number, you make a unique number and pass it the function. You can create unique n

Re: Creating a seq or openarray on unmanaged memory

2020-05-28 Thread Araq
> But Go's slices are memory-safe and zero-copy and can be stored, for example. They are technically memory-safe but prone to aliasing bugs anyway.

Re: Best Nim translation of C {void*, size_t} struct

2020-05-28 Thread Araq
It's supposed to work, yes and should be documented in the manual.

Re: Creating a seq or openarray on unmanaged memory

2020-05-28 Thread snej
> Only Rust has memory safe zero-copy collection that can be stored in a type > (their slice type). Not exactly. Only Rust has this _[plus](https://forum.nim-lang.org/postActivity.xml#plus) compile-time safety checks and zero runtime overhead. But Go's slices are memory-safe and zero-copy and

Re: Best Nim translation of C {void*, size_t} struct

2020-05-28 Thread snej
Just to make sure you're answering the exact question I asked :) — if I declare a C proc that takes an `openarray`, when Nim calls that function does it pass that parameter as a pointer followed by an int? For example: proc set_bytes(bytes: openarray[byte]) {.importc: "set_bytes".}

Re: Is there a command line one-line to start an HTTP server using Nim?

2020-05-28 Thread bung
make it depends on libzip optional sounds nice, user may not need full features.

Re: Nim Cheatsheet PDF (English+Spanish+Latex)

2020-05-28 Thread juancarlospaco
That was the idea, use it as template for more cheatsheets or other stuff. :)

Re: Nim Cheatsheet PDF (English+Spanish+Latex)

2020-05-28 Thread snej
Nice! I made a copy that's black-and-white, better suited for laser-printing: [https://www.overleaf.com/read/gytjmgdzmcdt](https://www.overleaf.com/read/gytjmgdzmcdt)

Re: Nim Cheatsheet PDF (English+Spanish+Latex)

2020-05-28 Thread Araq
Iteration order that depends on runtime values is a design bug.

Re: Is there a command line one-line to start an HTTP server using Nim?

2020-05-28 Thread kaushalmodi
After [https://github.com/enthus1ast/nimAsyncHttpTools/pull/2](https://github.com/enthus1ast/nimAsyncHttpTools/pull/2), `simplehttpserver` compiles and runs well on my machine (RHEL 6.8).

Re: Is there a command line one-line to start an HTTP server using Nim?

2020-05-28 Thread kaushalmodi
@bung You do not have an Issues section on your fork. I wanted to ask you if the dependency on libzip can be made optional? (See [my message above](https://forum.nim-lang.org/t/6386#39399) ). The original `nimhttpd` builds and runs fine on my machine (RHEL 6.8), but trying to run your fork fail

Re: Nim Cheatsheet PDF (English+Spanish+Latex)

2020-05-28 Thread juancarlospaco
Fixed. Maybe we need that overload (???) ;P

Re: VSCode debug: strings and booleans are ugly

2020-05-28 Thread juancarlospaco
`assercho` is `assert` and `echo` combined, with extra Debug, it shows the Nim code line and the C code line, works with bool and string. [https://github.com/juancarlospaco/nim-contra](https://github.com/juancarlospaco/nim-contra)

Re: Is there a command line one-line to start an HTTP server using Nim?

2020-05-28 Thread kaushalmodi
Awesome! That is the winner! @Araq It would be now cool to bake that into nim :)

Re: Is there a command line one-line to start an HTTP server using Nim?

2020-05-28 Thread kaushalmodi
OK, it builds find after uninstalling `zip` and doing `nimble install zip@#head`. So the correct fix is: 1. Cut a new release of the `zip` nimble package 2. Cut a new release of your `finder` package with updated zip version in its dependency 3. Finally update your `static_server` package

Re: Is there a command line one-line to start an HTTP server using Nim?

2020-05-28 Thread kaushalmodi
ok. .now it compiles, but doesn't run: > could not load: libzip(|2).so(|.4|.2|.1|.0) I'll have to figure this out later. I am using an admin managed OS, a very old OS: RHEL 6.8 (Linux).

Re: Is there a command line one-line to start an HTTP server using Nim?

2020-05-28 Thread kaushalmodi
I tried your repo as well. I cloned it and did `nimble build`, but it failed with this: [http://ix.io/2nAa/text](http://ix.io/2nAa/text) It looks like the `psutil` dependency needs to be updated for a backward incompatible change that happened in nim 1.0.0. Now we have `isDigit` taking only `ch

Re: Is there a command line one-line to start an HTTP server using Nim?

2020-05-28 Thread jackhftang
In case you just need the original nimhttpd like `python3 -m http.server`, run `nimble install nimhttpd` to install the binary and then run `nimhttpd` every time you want to serve static files.

Re: Is there a command line one-line to start an HTTP server using Nim?

2020-05-28 Thread kaushalmodi
The aim of my post was if there's a way that Just Works for kicking off an adhoc server, like `python3 -m http.server` does, **and** then have that baked into nim as well.

Re: Is there a command line one-line to start an HTTP server using Nim?

2020-05-28 Thread kaushalmodi
Hello, I cloned your repo and did `nimble build`. It failed with this error: [http://ix.io/2nA6/text](http://ix.io/2nA6/text) I am using the latest nim devel.

Re: Change Nim colour on GitHub

2020-05-28 Thread JPLRouge
yellow is difficult to read on a white background

Re: How to bypass a runtime error ?

2020-05-28 Thread fredg
I have tried it, in many ways, with no luck :( Thanks for trying. ++

Re: incorrect set-to-int conversion

2020-05-28 Thread Araq
> Is this a bug, or intentional? If the latter, is there a cleaner workaround > like a pragma? It's intentional but it's not part of the spec and we could change it. The workaround is to add an enum field that is mapped to 0.

Re: VSCode debug: strings and booleans are ugly

2020-05-28 Thread aviator
Oh, bummer. LLDB supports a Python API for pretty printing as well, but I don't think anyone has made a script for Nim yet.

Re: How to bypass a runtime error ?

2020-05-28 Thread mratsim
`try` / `except` or `try`/`finally` [https://nim-lang.org/docs/tut2.html#exceptions-try-statement](https://nim-lang.org/docs/tut2.html#exceptions-try-statement) from strutils import parseInt # read the first two lines of a text file that should contain numbers # and trie

Re: Stream IO errors with -d:release flag

2020-05-28 Thread mratsim
@Araq, how do you know it's a callback? When you create a proc to be used in C (callback): * Don't use exceptions * Don't use string or sequences * Deactivate stacktraces * Use `int32` or `cint` for `int` use `uint` or `csize_t` for `size_t` * tag `{.cdecl, gcsafe.}` your proc to detect

Re: Stream IO errors with -d:release flag

2020-05-28 Thread Araq
It's likely that your code is buggy. Use `setupForeignThreadGC()` in callbacks that are called from C and run in a different thread.

Re: Change Nim colour on GitHub

2020-05-28 Thread Araq
Fwiw orange is my favorite color.

How to bypass a runtime error ?

2020-05-28 Thread fredg
Hello, I am trying to build a list of mirrors and append the date when the mirror has been refreshed. (For doing that I take the last-modified header of a file) The program built without errors. The program begin to parse and print but, it ends if it meet an error during the parse. Is there a

Re: VSCode debug: strings and booleans are ugly

2020-05-28 Thread Kosteg
Unfortunately this won't work - GDB doesn't work on Mac since 10.14 Mojave

Re: Nim Cheatsheet PDF (English+Spanish+Latex)

2020-05-28 Thread SolitudeSF
thats not correct for i in 9..4: echo i # 9, 8, 7, 6, 5, 4 Run