Nim 1.2.10 RC and 1.4.4 RC

2021-02-18 Thread miran
> When can we expect a non RC release? Start of the next week. * * * We have new RCs, which if no regressions are reported will become the official releases: * 1.2.x: * 1.4

How to allow out of bounds access on sized arrays?

2021-02-18 Thread exelotl
Hey! I ran into some trouble while cleaning up my wrapper of a C library for GBA development. One of the things that the library exposes is a 2D array which maps out several chunks of 512 tiles (a.k.a. charblocks) in video memory. type Tile* {.importc: "TILE4", header: "tonc.

GCC Compiler - New to Nim

2021-02-18 Thread Yjuq
Nevermind :) I found a solution to it. Actually, I downloaded mingw32 from the download page and put it into the `dist` folder. I just added a config file: # nim.cfg @if windows: @if amd64: gcc.path = r"$nim\dist\mingw64\bin" @elif i386: gcc.path

windows - msys2 - rdynamic

2021-02-18 Thread mantielero
I have been investigating [this issue](https://github.com/mantielero/VapourSynth.nim/issues/1). After some struggle I have managed to reproduce it. I am using MSYS2, so that I could install the package `dlfcn`: $ pacman -S mingw-w64-x86_64-dlfcn Run Now I am getting

GCC Compiler - New to Nim

2021-02-18 Thread Yjuq
Hi there o/ I'm pretty new in nim but have actually programming knowledge for 10+ years. I almost avoided C++ / C completly during my career because I never quite understand how the toolchains and the compiler works. It was to much of a hussle and I still get big questions marks. Anyways, I have

String "interning" attempt

2021-02-18 Thread cblake
So, loading up that SOWPODS takes about 25 ms on my computer. That is a pessimal workload for interning since literally every single word is novel and induces an append. Running it under Linux `perf record -F25000` I get a `perf report` the top of which is: 47.90% sowint sowint

String "interning" attempt

2021-02-18 Thread shirleyquirk
what's your model, @rahulmittal79 ? appending to an array is, well, you know, as fast as it can be. Nim's allocator isn't advertised much, but it's honest-to-goodness amortized O(1), unlike some.

String "interning" attempt

2021-02-18 Thread cblake
Someone can correct me if I am wrong, but in lib/system/strs_v2.nim it seems growth will be doubling until 64 KiB and then 1.5x-ing afterward. So, there will be a little allocation time, but mostly just the standard amortized constant from exponential growth deal and checking there is space each

Conjunctions of sum type parameters

2021-02-18 Thread benob
Thanks, that's helpful.

Windows - #include

2021-02-18 Thread mantielero
It looks like mingw might be missing

String "interning" attempt

2021-02-18 Thread rahulmittal79
I'll try to test your model against mine for speed, but I guess appending to an array is not ideal for performance.

nim.cfg - pragma

2021-02-18 Thread mantielero
I checked and it doesn't work. I checked the documentation and it looks like only some of the compile time options are implemented: checks, boundChecks, overflowChecks, nilChecks, assertions, warnings, hints, optimization, patterns, callconv.

nim.cfg - pragma

2021-02-18 Thread pietroppeter
I think [push pragma](https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas) should work for you {. push threads:on, tlsEmulation:off .} Run

Conjunctions of sum type parameters

2021-02-18 Thread shirleyquirk
i see nothing wrong with your well-specified version, but there're many ways to achieve what you're after, including: proc ghelper(xy:(A,C)|(B,D)): echo xy proc g*[T,U](x:T,y:U)=ghelper((x,y)) #or template g*(x,y) = ghelper((x,y)) #or full manual: impor

Conjunctions of sum type parameters

2021-02-18 Thread mratsim
You can use `not A` if you want, but in your case better use an inner internal proc (can be inline) with the implementation and 2 public overload for the public use and restriction. It would be much easier to read and understand.

Patching existing libraries with "include"

2021-02-18 Thread enthus1ast
If its a reasonable change, why not create a pull request?

Conjunctions of sum type parameters

2021-02-18 Thread benob
I am playing with sum type parameters, and I'd like to specify types for parameters that play well together. For instance, I have a function that can take types (A, C) or (B, D) but I don't wont (A, D) or (B, C) to be valid. With sum types, f(A|B, C|D) makes every combo valid. Is there a way to

Binding to C macros functions

2021-02-18 Thread Clonk
> use nodecl not cdecl so that no definition is produced. I'll test it out. > There is nothing particularly different when it comes to binding C functions > vs macros in nim - in the end it is just a codegen. Perhaps I need to explain a bit more :). I'm making a Nim wrapper to the Julia progra

nim.cfg - pragma

2021-02-18 Thread mantielero
Sorry I have been a bit cryptic. I have this **transpose.nim** import vapoursynth Source("2sec.mkv")[0..30].Transpose.Pipey4m Run **transpose.nim.cfg** --threads: on --tlsEmulation: off Run Two files just for four lines I would lik

Patching existing libraries with "include"

2021-02-18 Thread juancarlospaco
Maybe we need `patchFile` from NimScript but for C target ?. *

Binding to C macros functions

2021-02-18 Thread mratsim
use `nodecl` not `cdecl` so that no definition is produced.

Windows - #include

2021-02-18 Thread mantielero
I am trying to compile in windows and I am getting the following error: λ nim c --threads:on --tlsEmulation:off ex00 Hint: used config file 'C:\Users\jose\Documents\nim-1.4.2\config\nim.cfg' [Conf] Hint: used config file 'C:\Users\jose\Documents\nim-1.4.2\config\config.nims

Binding to C macros functions

2021-02-18 Thread haxscramper_
There is nothing particularly different when it comes to binding C functions vs macros in nim - in the end it is just a codegen. Though as you mentioned in your comment this can be extremely unreliable due to codegen **and** C macros in the same place - stray comma can completely mess up everyt

Patching existing libraries with "include"

2021-02-18 Thread benob
I am trying to go around an issue with the standard lib keeping an object member private (. In order to do that, I abuse "include" to patch the library: # file patched_net.nim include net ...define new functions that I miss

Binding to C macros functions

2021-02-18 Thread Clonk
Hello, I've got a tricky question : Is Nim able to reliably bind function defined as macro in C code or am I wasting my time ? I'm talking stuff like : extern void coolFuncDontLookAtExplosion(void *); #define coolFuncDontLookAtExplosion(arg1) \ // define your super macr

"Error: unable to set ODBC driver version." with db-odbc

2021-02-18 Thread sky_khan
It was long time ago I've used ODBC but I'm sure ODBC connection string format is not the same as JDBC. You should check ODBC/Oracle documentation for proper connection string format of ODBC driver for Oracle.

nim.cfg - pragma

2021-02-18 Thread Symb0lica
You need to call your config file .nim.cfg not .cfg >From the Nim Compiler User Guide: A project can also have a project-specific >configuration file named $project.nim.cfg that resides in the same directory >as $project.nim. This file can be skipped with the --skipProjCfg command-line >option.

nim.cfg - pragma

2021-02-18 Thread juancarlospaco
I do not understand the question. You can use .cfg or .nims or CLI params.

Defects and CatchableErrors

2021-02-18 Thread mratsim
`SIGSEGV` isn't mapped to a Nim exception unlike DivByZero, but indeed this is something that also should be checked before actual use (null pointer for example).

nim.cfg - pragma

2021-02-18 Thread mantielero
In order to avoid adding all the time `nim c -r --threads: on --tlsEmulation: off filename.nim` when compiling, I create a `.cfg` file: --threads: on --tlsEmulation: off Run Is there a pragma that prevents me from doing so?

Defects and CatchableErrors

2021-02-18 Thread arnetheduck
> few such cases SIGSEGV? you usually can't tell what state your application is in after one of these, so you can't reliably raise or handle it. Options like `--panics:on` and `exceptions:goto` create a different dialects of the language that libraries you use may or may not support. Whether o

Nim 1.2.10 RC and 1.4.4 RC

2021-02-18 Thread Araq
Well, that is what we're doing, no?

Error: Closure iterators are not supported by JS backend!

2021-02-18 Thread miran
Here is a PR which reverts the commit that changed the 1.4.0 behaviour:

Error: Closure iterators are not supported by JS backend!

2021-02-18 Thread user71383
I checked my code and yes, you are right, the closure iterators never got used in my JS backend. But the compilation worked in 1.4.0 without generating an error message for the unused iterators. I put a bunch of **when not defined(js)** around the unused code and finally got 1.4.2 working. Th

How to access command line parameters under the JS backend

2021-02-18 Thread halloleo
Wow, how cool is this! Thanks a lot!

"Error: unable to set ODBC driver version." with db-odbc

2021-02-18 Thread halloleo
I am trying to connect to a database on our Oracle instance (in our local network), but can't get it to work. It might be that I forgot something stupid... I use: import db_odbc const CONSTR = "odbc:oracle:thin:@//.../.." var db = open(CONSTR, "...", "...", "")

Finally, I can do functional programming on tiny embedded systems

2021-02-18 Thread RichardWoodard
Good afternoon, for all questions that interest you or for complex programming projects it is best to contact the company / They are professionals in their field with whom you want to work further iot development is very important today

Defects and CatchableErrors

2021-02-18 Thread mratsim
To be fair, there are few such cases: * div by zero is the main one, which throws SIGFPE If you use vector instructions: * Trying to do an aligned load of unaligned address will throw SIGBUS If you use assembly: * You use the raw assembly division instruction to divide a 128-bit numb

Redis - how to select database

2021-02-18 Thread MerryMurray
Yes, thanks for the help.

How to access command line parameters under the JS backend

2021-02-18 Thread xflywind
they are implemented at devel

Strange memory problem

2021-02-18 Thread mantielero
O M G . I am feeling really stupid now. Just keep it between you and me! ;oP Thanks a lot.