Why is building the community and ecosystem such a struggle?

2023-10-20 Thread Akito
Incredibly fruitful discussion. Please, continue.

Compiling on i386: Pointer size mismatch between Nim and C/C++ backend

2023-10-13 Thread Akito
> The issue is in the build.sh script, it uses 'uname -m' to detect the arch, > but within Docker container this command returns cpu architecture of the host > machine (x86_64), and not the cpu of Docker's target platform. Yes. But all other architectures work (except s390x for other reasons I

Compiling on i386: Pointer size mismatch between Nim and C/C++ backend

2023-10-12 Thread Akito
> I don't think Nim will figure out that you want to build it for 32-bit then > unless you specify the --cpu flag yourself. > > Generally it’s best to not provide the —cpu option According to . > maybe something in the environment is messing it up? Like

Compiling on i386: Pointer size mismatch between Nim and C/C++ backend

2023-10-12 Thread Akito
Related to . Pointer size mismatch between Nim and C/C++ backend. You probably need to setup the backend compiler for target CPU. Run The compiler runs

static assert fails

2023-10-12 Thread Akito
Pretty much the same issue on i386.

Explanation for SSL/TLS Error

2023-08-22 Thread Akito
Yes, makes sense, as in Nim getting confused. In all my trials, I had the following scenarios. I cannot list all, because I spent too much time trying to figure out the problem. 1. Only OpenSSL 1.1 2. Only LibreSSL 1.1 3. Only OpenSSL 3 4. Only LibreSSL 3 5. OpenSSL & LibreSSL 1.1 6.

Explanation for SSL/TLS Error

2023-08-21 Thread Akito
I think, I finally got to the point of being able to prove, that the standard library's `smtp` library is broken.

Explanation for SSL/TLS Error

2023-08-20 Thread Akito
For now, the issue does not appear anymore. My program worked. Then TLS stopped working in Alpine. A day later it stopped working on the dev machine, too. Been trying to figure out the solution, since then. I had created a backup of the non-working setup, which has worked before. Now, it starte

Explanation for SSL/TLS Error

2023-08-20 Thread Akito
Thanks for the suggestion. Wasn't easy to apply this fix, as it needed some adjustments. I'm getting this error, which I had seen before, along my journey to getting this fixed, at some point, already. @m..@s..@snim@slib@swrapp...@sopenssl.nim.c:52: undefined reference to `SSL_get

Explanation for SSL/TLS Error

2023-08-20 Thread Akito
/nim/lib/wrappers/openssl.nim(373) sslSymNullable /nim/lib/wrappers/openssl.nim(347) sslModule Error: unhandled exception: Could not load SSL using libssl.so(.3|.1.1|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|.48|.47|.46|.45|.44|.43|.41|.39|.38|.10|) [LibraryError] Run I would

Nim version 2.0.0 is here

2023-08-02 Thread Akito
Wow, great job! I'm super excited! :)

Do you miss these compact syntaxes?

2023-04-01 Thread Akito
I strongly oppose to the suggestions made in the original post, because they are too ambiguous & unclear. For example, multi-line strings via normal double quotes just reminds me of how fucked up Bash works. A normal string should be double quoted, a multi-line, huge one, with other implication

Times in the VM?

2023-04-01 Thread Akito
@timothee Just adding `{.push experimental: "vmopsDanger".}` to the script's top does not change anything. Adding `--experimental:vmopsDanger` as a CLI flag fixes the `importc` error, but it creates another error, instead. times.nim(1307, 6) Error: cannot evaluate at compile time:

Nim v2.0.0 RC2 is out

2023-04-01 Thread Akito
Happy to see this being an "evolution" rather than a "revolution"... One of the things worst about Python is its madness with version 2 vs 3. It literally _broke_ tons of operating systems under my control & systems from other people I know personally & from people I have talked to online. Plea

A serious documentation for Nim

2022-12-31 Thread Akito
Thank you. Been thinking that since I saw Nim for the first time. The biggest issue with Nim is that the amount of documentation is laughable. Yes. I know all the books & **I have read all the official documentation entirely, several times**. Including all the documentation regarding standard li

Async Socket with SSL Context throws "error:1420C114:SSL routines:ssl_write_internal:uninitialized"

2022-12-31 Thread Akito
"Fixed" it by changing this proc connect*(imap: ImapClient; host: string, port = imapPort) {.async} = ## Establish a connection to an IMAP server await imap.sock.connect(host, port) await imap.checkOk() Run to this proc connect*(imap: Ima

Async Socket with SSL Context throws "error:1420C114:SSL routines:ssl_write_internal:uninitialized"

2022-12-31 Thread Akito
> Did you compile with -d:ssl? Well, yes, else I would get a compilation error about not compiling with SSL, rather than a runtime error, when a connection is established and TLS is apparently supposed to be used.

Async Socket with SSL Context throws "error:1420C114:SSL routines:ssl_write_internal:uninitialized"

2022-12-30 Thread Akito
When trying to use [this library](https://git.sr.ht/~ehmry/nim_imap/tree/master/item/src/imap.nim), I get a `error:1420C114:SSL routines:ssl_write_internal:uninitialized`, whenever I use any proc, which uses `sendLine`, which essentially is just a `imap.sock.send(line & CRLF)`. This is how the

Illegal storage access

2022-07-28 Thread Akito
> Importing the segfaults module allows you to catch a segfault like you would > an exception. Though, I think I remember reading, that this is not intended and is just a side-effect, which is too often exploited. Additionally, `segfaults` is considered broken. >From my experience, you most of

Suddenly getting infinite genericDeepCopy recursion

2022-07-27 Thread Akito
After more than a year, I tried again to debug this problem. I got to the root of the issue's code location, to some degree at least. Using current stable Nim 1.6.6. This is how deep I co

Can Nim be made more "purely functional""...

2022-06-17 Thread Akito
There have been many good points here regarding the essence of the topic. Thanks to everyone for contributing. It was a joy to read this discussion. I wanted to extend one specific part of the topic: what makes life easier in the long run. I'm sure some of you already know the following video,

Regular expressions in Nimscript?

2022-04-07 Thread Akito
Thanks for the answer. Do you mean checking manually for compliance with Semver, without using a Regex? I copied the Regex from some website. I didn't care how it looks, I just wanted it to work correctly. Could you please tell me why `reSemver = re"..."` is not good code? How could I improve

Regular expressions in Nimscript?

2022-04-07 Thread Akito
I expiremented a bit, and my conclusion is, that using the `regex` library in Nimscript will always work, except you are invoking `nimscript`'s `exec` proc. (Or any other proc using `nimscript`'s `log` template.) If that `exec` proc wouldn't use `nimscript`'s `log` template, then it would all wo

Regular expressions in Nimscript?

2022-04-07 Thread Akito
I've come to the same conclusion, trying this `regex` library, but I get a `~/.choosenim/toolchains/nim-1.6.4/lib/system/nimscript.nim(205, 6) Error: cannot evaluate at compile time: mode` constantly, when trying to use the library. I tried several methods. Using `std/os`, removing it again, et

Nim project using C++ Backend with single module using library wrapping a C library

2022-03-10 Thread Akito
Indeed, it's possible. I have thought about the solution, but the manual implicates, that this method of using C++ should be avoided, whenever possible.

Nim project using C++ Backend with single module using library wrapping a C library

2022-03-08 Thread Akito
In the end, I just re-implemented Hunspell in C. Was the easiest idiomatic solution, but not the quickest. I had trouble with `cstringArrayToSeq`, where it incorrectly deduced the actual array

Nim project using C++ Backend with single module using library wrapping a C library

2022-03-03 Thread Akito
Before choosing a library, I was investigating which one would fit best. I was trying to find a simple one, but the simplest I found was Hunspell. I had seen your libraries, too, well, at least I remember the suggest library, but it seemed more like a paper than anything, so I didn't get the imp

Nim project using C++ Backend with single module using library wrapping a C library

2022-03-03 Thread Akito
Thanks for the suggestion. Yes, using a dynamic library seems obvious, but I don't like adding such stuff to small Nim programs. It's too much bloat for such a slim program. After thinking about the situation, I would consider either statically linking the database module with the rest of the p

Nim project using C++ Backend with single module using library wrapping a C library

2022-03-03 Thread Akito
I am currently working on a project, which uses a Nim library, which is basically wrapping a `.h` file with nimterop. My project additionally wrapped a `.hxx` (C++) file the classic by the book Nim way. Now, I have the problem, that I have to compile the project with the `cpp` backend, to make

String related Segmentation Faults

2021-08-01 Thread Akito
I'm back with good results. First of all, thank you all very much! You really helped a lot. I combined the suggestion given to me, then debugged the crap out of the program and now it runs as it should! Comparing Nim 1.5.1 a.k.a. current development version of Nim to Nim 1.4.8 a.k.a. current s

String related Segmentation Faults

2021-07-27 Thread Akito
Thanks a lot to everyone for these very helpful replies. :) I will investigate all cstring usages extremely carefully and will try to avoid juggling with (c)strings. I'll keep this thread updated. Thank you!!

String related Segmentation Faults

2021-07-27 Thread Akito
I have been trying to find the reason for this issue for days, and can't seem to find it. Perhaps something stupidly easy I am simply missing? I don't know. The problem is, that I am unable to reproduce the error in a small example. I only encounter this problem in a bigger project, that I canno

Suddenly getting infinite genericDeepCopy recursion

2021-05-01 Thread Akito
Speaking of recursions, I checked all the loops in my program and yes, there is one main loop and a few other loops, however they are very flat. Additionally, the main loop is precisely according to its official documentation, which is valid since pretty much over 20 years so I doubt it's relate

Suddenly getting infinite genericDeepCopy recursion

2021-05-01 Thread Akito
Now I compiled with `--define:release` and the error is gone. Not sure what is supposed to be optimized away in the code.

Suddenly getting infinite genericDeepCopy recursion

2021-05-01 Thread Akito
@mashingan Thank you for the quick response. I compiled with `-f`, however I did not seem to have a cache related problem before, as it usually compiled everything on each change, anyway. So, the result is the same, even when forcing compilation of everything. Not sure what you mean by saying

Suddenly getting infinite genericDeepCopy recursion

2021-05-01 Thread Akito
Traceback (most recent call last) /home/akito/.choosenim/toolchains/nim-1.4.6/lib/system/deepcopy.nim(190) genericDeepCopy /home/akito/.choosenim/toolchains/nim-1.4.6/lib/system/deepcopy.nim(132) genericDeepCopyAux /home/akito/.choosenim/toolchains/nim-1.4.6/lib/system

To slice or to stream?

2020-11-10 Thread Akito
Which snippet is more performant and "better" for this situation? (Both deliver the exactly same result.) Slice: let result_raw = raw_string tailLen = result_raw[0..0].parseHexInt() result = result_raw[1..^1] result.removeSuffix(spaces(tailLen))

quit() returning bool in else branch?

2020-11-05 Thread Akito
> Your ok function returns bool and is {.discardable.} correct? > > The type of an if stmt is determined by it's first branch. Wow. You are precisely correct. I did not know about the type thing for an if statement. > So this may be a bug with how quit() interacts with discardable. Although, t

quit() returning bool in else branch?

2020-11-04 Thread Akito
I've encountered something weird. Not sure if it is a bug or if I'm missing something. Works: if not init(): quit(1) else: ok() Run Does not work: if init(): ok() else: quit(1) Run Telling me: >

Inspecting provided `type` within macro

2020-10-17 Thread Akito
@geotre Wow, thank you so much, this helped really A LOT! For future readers, my `macro` expects a type MyObj = ref object of myObj stringField: string power: int Run So here is the spec for retrieving the `RecList` from a `ref object`:

Inspecting provided `type` within macro

2020-10-17 Thread Akito
I am trying learn more about how Nim macros work and get used to them. In this case, I want to pass an `object` `type` as an argument to a `macro`, which then inspects the provided `object` `type` and gets all fields (only `var` or `let` sections are expected) as `NimNode`s. Then, I want to do f

Confusing behaviour with cstringArray

2020-10-03 Thread Akito
That explains it, I understand now. Thanks to you both for the great explanations and the effort in answering my questions.

Confusing behaviour with cstringArray

2020-10-03 Thread Akito
Thank you very much for the great explanation! > Casting between them is undefined behavior, probably resulting in a segfault. Well, all I was getting was a `-1` from `execvp`, so didn't really know what was going on. I also don't know how to handle C errors in Nim. I certainly did not get an e

Confusing behaviour with cstringArray

2020-10-03 Thread Akito
Why does this work: var cmd = commandLineParams() cmd.delete(0) let ccmd = cmd.allocCStringArray() echo execvp(ccmd[0], ccmd) Run But this does not: var cmd = commandLineParams() cmd.delete(0) echo execvp(cast[cstring](cmd[0

paramCount in NimScript not working?

2020-08-10 Thread Akito
Greetings, thank you for your suggestion. I will look into it and try other alternatives, as well.

paramCount in NimScript not working?

2020-08-09 Thread Akito
* [https://forum.nim-lang.org/t/6274](https://forum.nim-lang.org/t/6274) * [https://github.com/nim-lang/Nim/issues/12835#issuecomment-562973489](https://github.com/nim-lang/Nim/issues/12835#issuecomment-562973489) * [https://github.com/nim-lang/Nim/issues/14142](https://github.com/nim-lang/

using seq for Table key

2020-08-03 Thread Akito
First of all, I apologise for resurrecting a 4 year old thread. @britto Thank you for documenting your approach and how you succeeded with it. Indeed, your solution works still in 2020. It even works when using the Table[seq[int], seq[int]] as the result type of a proc. The only downside is,