IndexError: list index out of range

2021-03-16 Thread xigoi
>From the last line, it seems that Nimporter expects the Nim file to have at >least one line. Did you write anything in it?

How can I see all the threads I ahve started or I have contributed to?

2021-03-16 Thread halloleo
Done. (The upvote, Nim PRs not yet...)

Criticism of Parallel Nim

2021-03-16 Thread boia01
Yes, I can write a blog post about this. I won't be able to share the specific code (it's proprietary) but I can create an example project that looks pretty close to it. It's a web server that receives/sends json and does postgres database calls. Not very fancy but overall representative of a lo

Performance comparison of various compilers

2021-03-16 Thread rockcavera
Congratulations. This shows that Nim can be as fast as C. Your current code, here, runs, on average, 86ms, against 71ms of C.

Missing Symmetry: varargs vs. all

2021-03-16 Thread ynfle
https://github.com/technicallyagd/unpack

Issues regarding calling an import from python as a routine

2021-03-16 Thread able
OK

getCurrentDir vs getHomeDir output

2021-03-16 Thread timothee
=>

Learning Nim: Web Server with Jester and Norm [video]

2021-03-16 Thread alfrednewman
Nice job dude!

async - noob question

2021-03-16 Thread ynfle
It seems like you missing the following line: if server.shouldAcceptRequest(): Run Not sure if that'd make a difference, but please do tell.

Missing Symmetry: varargs vs. all

2021-03-16 Thread alexeypetrushin
Would be nice to have something like that let [first, second, ..., last] = people let [first, ...middle, last] = people let some_people = [...middle, last] let terran = (race: "Terran", life: 0) let jim = (terran..., name: "Jim", life: 70) let jim = terran & (

async - noob question

2021-03-16 Thread mantielero
A better solution seems to be: await server.acceptRequest(cb) drain() Run but I still don't get how `waitFor` works. It doesn't seem to block the required ammount of time.

async - noob question

2021-03-16 Thread mantielero
It works with: import std/[asyncdispatch, asynchttpserver]#, os proc main {.async.} = const port = 8080 var server = newAsyncHttpServer() proc cb(req: Request) {.async.} = echo (req.reqMethod, req.url, req.headers) let headers = {"Con

async - noob question

2021-03-16 Thread mantielero
Still playing with this (trying to actually understand what is going on). I have the following code: import std/[asyncdispatch, asynchttpserver]#, os proc main {.async.} = const port = 8080 var server = newAsyncHttpServer() proc cb(req: Request) {.a

Missing Symmetry: varargs vs. all

2021-03-16 Thread SolitudeSF
this opportunity is forever lost (for the better)

Missing Symmetry: varargs vs. all

2021-03-16 Thread DavidKunz
... or in other words: The compiler needs to handle `varargs` in a different way than other types. It's a special case.

Missing Symmetry: varargs vs. all

2021-03-16 Thread DavidKunz
What I meant with 'hack' is: The compiler will loop over all arguments, one by one and bring each input variable into the local function scope, _[except](https://forum.nim-lang.org/postActivity.xml#except) if its argument type is `varargs`. So I wouldn't call it a _[real](https://forum.nim-lang

Missing Symmetry: varargs vs. all

2021-03-16 Thread DavidKunz
Thanks Yordanico for your reply! > there's no such thing in Nim to specify the type of the argument (or part of > it) before the name. Is `varargs[int]` really a type in the eyes of the compiler? It looks more like a hack to capture multiple arguments.

Missing Symmetry: varargs vs. all

2021-03-16 Thread Yardanico
It doesn't look like a hack for me at all, it's merely a different way of specifying a variable amount of arguments. The only difference to your JS example is how to add it to the proc arguments

Weird error between sequtils and nim-result

2021-03-16 Thread akavel
I'm trying to use sequtils together with the nim-result library, and I'm getting an error like below. When I split `mapIt` and `filterIt` to separate lines, it compiles fine. The same error shows up both for nim-result and pkg/stew/result. Is this a bug in the stdlib? or in the result library? o

Missing Symmetry: varargs vs. all

2021-03-16 Thread Yardanico
Pattern matching is much, much, much newer than varargs. And honestly your proposal makes the language less "symmetric", if anything, because there's no such thing in Nim to specify the type of the argument (or part of it) before the name. Pattern matching uses that because it's more natural fo

Missing Symmetry: varargs vs. all

2021-03-16 Thread DavidKunz
Hi, I noticed a missing opportunity to have more symmetry in the Nim language. Consider `varargs` in procedure arguments and `all` in pattern matching: proc someProc(first: int, rest: varargs[int]) = echo rest # [2, 3] someProc(1, 2, 3) Run

New Nesper release: v0.6.0 includes Nimble build tasks for ESP32 projects!

2021-03-16 Thread elcritch
Thanks! Unfortunately no, the ESP8266 uses an entirely different code base from the one for ESP32's. On the upside, the new FreeRTOS based ESP-IDF looks to be their main platform for all future chips and possibly the [ESP8266](https://www.esp32.com/viewtopic.php?t=11315) at some point. Though s

Performance comparison of various compilers

2021-03-16 Thread mratsim
> Why is it using float64 everywhere? This is computer graphics not > computational physics! Changing everything to use float32 I get float64 vs float32 is a huge debate in the raytracing community even in Academia. A naive raytracer can likely use float64, a raytracer reorged using something s

Strange "lock levels differ" error with HttpClient

2021-03-16 Thread mratsim
No it's not that they aren't welcome but they were not given the love they deserve so far.

getCurrentDir vs getHomeDir output

2021-03-16 Thread xioren
I'd be happy to do a PR but there would need to be some consensus on trailing forward slashes. IMO using trailing slashes or not is a somewhat arbitrary choice, the important thing is consistency.

Nim SDL2 Game Development for Beginners #2 Adding walls and explaining image depth

2021-03-16 Thread Kiloneie
In this video we will create a new Wall object and then place Wall objects around the Window. We will also add a Player object and restructure the code we used to move the astronaut image around to be the Player object one, and then i will showcase and explain depth and how it can be implemented

Issues regarding calling an import from python as a routine

2021-03-16 Thread Yardanico
Please refrain from hijacking other threads in the future. Just create a new thread like you already did, don't post in existing ones.

Issues regarding calling an import from python as a routine

2021-03-16 Thread able
Traceback (most recent call last): File "C:/main.py", line 2, in import nmath # Nim imports! File "", line 991, in _find_and_load File "", line 971, in _find_and_load_unlocked File "", line 914, in _find_spec File "C:python38libsite-packagesnimporter.py", line 1150, in find_spec re

IndexError: list index out of range

2021-03-16 Thread able
Traceback (most recent call last): File "C:/main.py", line 2, in import nmath # Nim imports! File "", line 991, in _find_and_load File "", line 971, in _find_and_load_unlocked File "", line 914, in _find_spec File "C:python38libsite-packagesnimporter.py", line 1150, in find_spec re

Wrapping C Function Pointer Question

2021-03-16 Thread marcomq
As summary, this could be: type Callback = proc(customArg: pointer, columnCount: cint, values, columns: cstringArray): cint {.cdecl.} Run

Compiling Nim project for arm/arm64

2021-03-16 Thread drkameleon
That's what I thought too - but suddenly I end up with one million missing headers. For examples, I'm using GMP. When I compile normally, every goes fine. When I switch to arm, suddenly the very same `gmp.h` (that is of course there) "cannot be found". So, I've been wondering if I'm doing some

Compiling Nim project for arm/arm64

2021-03-16 Thread drkameleon
Given a failed attempt (and a failed attempt at asking the right question: , here I am again. So... Let's ask the question in a more naive way: how do I go about compiling a Nim project for arm/arm64? (Any Linux or macOS version will do - what I want to know

Compiling Nim project for arm/arm64

2021-03-16 Thread SolitudeSF
all i had to do when crosscompiling to arm is install arm compiler provided by my distro and add `--passL:"--sysroot=/usr/arm-linux-gnueabihf/"`

Performance comparison of various compilers

2021-03-16 Thread xigoi
I'm surprised they included many modern systems languages, but not Rust.

Issues regarding calling an import from python as a routine

2021-03-16 Thread xigoi
Right. Only use `nimpy` if you need a Python library that doesn't have a good Nim equivalent.

Dll with a different entry point as Dllmain

2021-03-16 Thread Araq
Compile with `--noMain` and use some linker command to specify the entry point's name. Maybe it's possible, I never had to do that.

Wrapping C Function Pointer Question

2021-03-16 Thread ElegantBeef
You may also need `{.cDecl.}` or `{.noConv.}` on the type to make it interoppable with the C code.

Dll with a different entry point as Dllmain

2021-03-16 Thread PMunch
Yes, you just attach the pragmas `{.stdcall,exportc,dynlib.}` to the procedure and you can export any procedure just fine.

New Nesper release: v0.6.0 includes Nimble build tasks for ESP32 projects!

2021-03-16 Thread PMunch
Really nice, I looked into this when I was programming my ESP8266. Are there any plans to add support for this chip, or are you solely focused on the ESP32?

getCurrentDir vs getHomeDir output

2021-03-16 Thread Araq
> paths should be compared semantically (with os.cmpPaths) but that's a > separate issue. Depends on your point of view. At least with the current inconsistency you're forced to write the code properly and use `os.cmpPaths`. After we patched it bad code would start to "work".

Question about Macros and AST Documentation

2021-03-16 Thread ynfle
The [macros module documentation](https://nim-lang.org/docs/macros.html) has most of the information that you'd need. [Here](https://nim-lang.org/docs/macros.html#statements-type-section) is the section on a type declaration.

getCurrentDir vs getHomeDir output

2021-03-16 Thread timothee
IMO it's a bug that should be fixed (with the usual `-d:nimLegacyHomeDir`), upvote PR welcome to see what would break. > `getHomeDir() == getCurrentDir()` note, paths should be compared semantically (with os.cmpPaths) but that's a separate issue.

How can I see all the threads I ahve started or I have contributed to?

2021-03-16 Thread timothee
known issue, please upvote

Retrieve content from a URL under the JS backend

2021-03-16 Thread timothee
jsfetch?

Wrapping C Function Pointer Question

2021-03-16 Thread hankas
Hi, I am new to Nim, and I am still learning. How do you wrap the following C function pointer in Nim? int (*callback)(void*,int,char**,char**) Run I tried to do the followings but it does not seem to work. type Callback = proc(customArg: pointer