Super-weird error with builds on latest Windows runner (Github)

2024-05-18 Thread z_____________
Probably related to , fixed in devel.

Super-weird error with builds on latest Windows runner (Github)

2024-05-18 Thread z_____________
Adding `-Wno-error=incompatible-pointer-types` to (via --passC or similar) as suggested by lou15b in that thread should be enough to get around this issue.

Can I check if a proc is async at compileTime without a macro?

2024-05-04 Thread z_____________
As an aside, `a is proc(): Future[void] {.nimcall.}` is true.

Can I check if a proc is async at compileTime without a macro?

2024-05-04 Thread z_____________
`a() is Future`?

Can I check if a proc is async at compileTime without a macro?

2024-05-04 Thread z_____________
Parentheses need to go around a(), not `a() is Future`. Typeof doesn't evaluate its argument at compile time, so slapping some default(T)'s in there should work.

Errors within async are not being raised

2023-12-02 Thread z_____________
The program quits after "u 25" because the code generated by cligen.dispatch discards the Future returned by main. Try making main non-async by replacing `await client.getFile` with `waitFor client.getFile` and removing the `async` pragma, or making a new proc calls `waitFor` on main and dispat

Does seq have a method to get mutable ref element?

2023-09-09 Thread z_____________
`var list = @[1,2,3] for n in list.mitems: if n == 2: n = 3 echo list == @[1,3,3] ` Run

Why json hooks doesn't work for CountTable[int]

2023-06-18 Thread z_____________
Looks like it's because std/jsonutils.toJsonHook for tables only accepts those with strings for keys. Converting the keys to strings when building the table should work: proc toJsonHook*[K](t: CountTable[K]): JsonNode = var t2: Table[string, int] for k, v in t: t

Error: expression has no type (or is ambiguous)

2023-05-20 Thread z_____________
If that's [stripLineEnd from std/strutils](https://nim-lang.org/docs/strutils.html#stripLineEnd%2Cstring), it operates in-place and doesn't return anything. Consider using it with [dup from std/sugar](https://nim-lang.org/docs/sugar.html#dup.m%2CT%2Cvarargs%5Buntyped%5D).

Can I add Procs to Enums in Nim like in Python or Rust?

2023-03-04 Thread z_____________
Enums are just like any other type. You can "attach" procs to them like you can any other type. Here's the equivalent of that Python enum code: import std/strformat type Mood = enum Funky = 1 Happy = 3 func describe(mood: Mood): (string, int)

jsFetch fetch

2022-04-12 Thread z_____________
Looks to me like an unintentional omission in `std/jsfetch`: func newfetchOptions*(metod: HttpMethod; body: cstring; mode: FetchModes; credentials: FetchCredentials; cache: FetchCaches; referrerPolicy: FetchReferrerPolicies; keepalive: bool; redirect = frFollow; refer

`$` not working on custom type when imported in other modules

2022-03-27 Thread z_____________
If we call `$` explicitly, we get a more illuminating error message: `Error: ambiguous call; both dollars.$(x: int64) [proc declared in /path/to/lib/system/dollars.nim(14, 6)] and lib.$(i: Int_b) [func declared in /path/to/lib.nim(3, 6)] match for: (Int_b)`

How to read GeoLite2 mmdb files?

2021-05-25 Thread z_____________
There's my [nim-mmdb](https://github.com/z-/nim-mmdb) which is a pure Nim implementation and is reasonably feature-complete as far as I know; see [here](https://github.com/z-/nim-mmdb/blob/9a4138d94dc044a82a97902c412f0f590e92054d/src/mmdb.nim#L437) for example usage. (C

In Nimpy how to call methods on Python objects? (Example sys.path.insert)

2021-04-29 Thread z_____________
It works when you add `discard`: import nimpy let sys = pyImport("sys") discard sys.path.insert(0, ".") Run The problem with the original code is that Nim does not allow return values to be implicitly discarded.