Suggestions to reduce the number of compiler warnings for rtree module?

2021-01-08 Thread Stefan_Salewski
I was trying to add an items() iterator. As Nim interators do not support direct iteration, it can be done with a stack or references to the parent and the current child. As the parent reference was already there I added a cur index and got this, which seems to be OK: H[M, D: Dim;

NimDBX (libmdbx key/value database wrapper) now nimble-installable, whew

2021-01-08 Thread VP8M8
Is there a specific reason why you use the Apache 2.0 license? Seeing as libmdbx is licensed under the more permissive and compatible OpenLDAP (basically BSD 3-clause) would you be willing to switch or dual-license it under the MIT? I mainly ask because Apache 2.0 is not compatible with the GPLv

SSLError WebSocket

2021-01-08 Thread treeform
Do you get the same issue with ? I do get strange errors from servers that fail to send the full ssl connection. They start sending the SSL handshake then terminate connection midway through. Then you get this SSL error, it might be telling you that the connectio

Bug? Compiled code throws some C-lang error.

2021-01-08 Thread alexeypetrushin
Thanks, seems like the code below is also a bug, as it compiles and runs, but it shouldn't. As there's an error - the return of the `(r) => (r - 1)` expression is `int`, but the `findi_min` expect a proc with the `float` as return type, seems like it shouldn't compile... import su

Bug? Compiled code throws some C-lang error.

2021-01-08 Thread haxscramper_
It seems like one, because replacing `(r) => (r - v).abs` with `proc(r: int): float = float abs(r - v)` solves the issue. My guess that it is related to proc signature inference - you require `T -> float`, but `r => abs(r - v)` by itself is `int -> int`, but your proc expects `int -> float`

Bug? Compiled code throws some C-lang error.

2021-01-08 Thread alexeypetrushin
Code below throws C-lang error, seems like a bug? The example is a broken (to make example simpler) implementation of the `argmin` function. [playground](https://play.nim-lang.org/#ix=2LlC) import sugar, sequtils func findi_min*[T](list: openarray[T], op: (T) -> float): in

Stdlib and fusion evolution

2021-01-08 Thread arnetheduck
Symbol renaming is indeed how modern languages / environments solve the issue:

Documentation for osAllocPages etc.?

2021-01-08 Thread Araq
It doesn't have to be virtual memory, any writable memory will do, for example, `sbrk` should work too.

Documentation for osAllocPages etc.?

2021-01-08 Thread czietz
Thank you for the explanation. Unfortunately, there is no mmap() on TOS. (There's not even virtual memory / a virtual address space to begin with.)

Documentation for osAllocPages etc.?

2021-01-08 Thread Araq
Atari TOS probably supports enough of Posix to offer `mmap` so all you need to do is to connect `osAllocPages` to `mmap` like the code already does. > Which alignment is expected from the pages returned by osAllocPages? We require `PageSize` alignment, defined in `lib / system / bitmasks.nim`.

Documentation for osAllocPages etc.?

2021-01-08 Thread czietz
One of the next steps in porting [Nim to Atari TOS](https://forum.nim-lang.org/t/7335) would be doing what osalloc.nim keeps telling me: _Port memory manager to your platform_. Then I would not have to compile with define:useMalloc and restricted choice of garbage collectors. Is there any docum

Unable to use HashSet for my type

2021-01-08 Thread mratsim
In many case when you have ref objects you also want ref semantics for the hash, not value semantics.

SSLError WebSocket

2021-01-08 Thread BeardPower
Hi there, I'm using for communicating with WebSockets. Using the latest Nim version, I receive the following error: Exception message: error:141640B5:SSL routines:tls_construct_client_hello:no ciphers available Exception type: [SslError] Does the net module mi

Exceptions which can hold / pass an object?

2021-01-08 Thread HJarausch
Thanks. AFAIK this requires to write something like _newMyException_ since I don't how to initialize the fields of _MyException_. Unfortunately, newException(MyException(myfield=1)) Run does not work since _newException_ expects a type argument.

Interfacing with va_list from stdarg.h

2021-01-08 Thread greenfork
Thanks for `cstring`, completely slipped my mind! And thanks for the hint about trying to wrap C functions, this worked! As I understand it, wrapping `va_arg` and friends would require the function definition in C to be with 3 dots something like typedef void (*TraceLogCallback)(i

Interfacing with va_list from stdarg.h

2021-01-08 Thread Araq
`text: string`? a `char*` is a `cstring`! As for your question, you need to wrap `va_arg` and friends, see for example

Exceptions which can hold / pass an object?

2021-01-08 Thread PMunch
The standard Nim exception just has a name and a message as you've discovered. But by inheriting from one of the `Exception` objects (probably you'll want to inherit from `Defect`) you can define any number of fields or collections to go along with your exception.

Unable to use HashSet for my type

2021-01-08 Thread Araq
Because it's futile, objects are complex, you need to opt-in if you know that field-wise hashing/comparsion are the right semantics. We already have this "helpful" `$` proc for objects that keeps producing bugs. No thanks, we don't need more of that.

Unable to use HashSet for my type

2021-01-08 Thread PMunch
Probably because no-one has PRed it yet. Quick! Before someone else does it!

Questions about sharing data with C++ and capnp.nim

2021-01-08 Thread Recruit_main707
Executing test1 does nothing, I should make a more elaborate example, I will add those changes to export though, thanks

LibSSL DLLs and DLL collections for older versions

2021-01-08 Thread PMunch
Recently the automatic build of one of our projects at work failed because libssl was suddenly gone from the collection of DLLs that can be downloaded from the Nim website to work with various standard library modules. Where did it go? Is it no longer needed? And as an aside, is it possible to g