Exceptions which can hold / pass an object?

2021-01-10 Thread HJarausch
Thanks! I am concerned about that _owned(ref..)_ construct in the standard _newException_ definition. I understand that an exception can't be allocated on the stack. The construction _raise MyException(count:3)_ does this, as well. But the _owned(ref..)_ is missing - or is it generated by the co

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

2021-01-10 Thread VP8M8
Apache 2.0 is basically MIT or BSD 2-clause (also called Simplified BSD) with the addition of a royalty-free patent grant. The BSD 3-clause (also called New BSD) adds a line stating that the contributor's names can't be used to promote products derived from the software without prior permission.

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

2021-01-10 Thread snej
I’m just used to Apache-licensing everything because that’s what we use at work. TBH I’m not that aware of the subtle differences between that, BSD and MIT. (I’m not a fan of coercive licenses like GPL. I’m actually kind of amused to hear that my using Apache causes problems with GPL code, beca

Exceptions which can hold / pass an object?

2021-01-10 Thread snej
Usually I create an empty instance with newException, assign field values, then call `raise`. I don’t understand the need for newException, to be honest. Why are exceptions special this way? I should be able to declare an exception subclass as ref, then instantiate one normally and raise it. Bu

Base64-decoding binary data to byte array

2021-01-10 Thread snej
Most platforms have to deal with library API evolution. Typically, if a function is found to be problematic in its very signature, like this one, you deprecate it and add a replacement function in the same library. In this case it could be a `decodeBytes` proc that returns a `seq[byte]`. That do

How to pass around large immutable data? Copy-on-Write?

2021-01-10 Thread snej
I don’t think Nim does COW automatically. Types like seq and string do it, but that’s part of the implementation of the type: internally they contain a reference to a shared heap-based array. You may be thinking of the way that values passed as function parameters aren’t copied; this is safe be

Any plans for syntactic sugar for parameter unpacking?

2021-01-10 Thread pietroppeter
I would go with: type Person = tuple[name, family: string] proc hi(p: Person): string = "hi " & p.name & " " & p.family Run

Any plans for syntactic sugar for parameter unpacking?

2021-01-10 Thread Hlaaftana
My custom unpacking library has a [macro for this](https://hlaaftana.github.io/defines/defines.html#unpackArgs.m%2C%2C). Although it feels pretty pointless to me I first wrote it as a comment in some RFC and it got like 1 or 2 upvotes so I added it. Syntax is subjective sometimes anyway. The ar

Resize window events karax

2021-01-10 Thread sdmcallister
The Karax eCharts experiment provides MWE similar to what I might create, so I won't re-paste here unless that is preferrable. Images resize without issue when the window is changed. In the past when I've used echarts and regular java

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

2021-01-10 Thread Recruit_main707
feel free to ping me in the discord/irc server if you have any doubts

Resize window events karax

2021-01-10 Thread geotre
You can trigger Karax to redraw when the window size changes with something like: proc onResize(ev: Event) = # maybe do something with display width, e.g. using document.body.clientWidth redraw() window.addEventListener("resize", onResize) Run You

How to add a parameter based on a variable?

2021-01-10 Thread geotre
Maybe make a helper proc using `cstring(nil)` as in Karax's `toSelected`/`toDisabled`/`toChecked` procs -

Any plans for syntactic sugar for parameter unpacking?

2021-01-10 Thread juancarlospaco
https://github.com/Yardanico/nimpylib#usage

Advent of Nim 2020 megathread

2021-01-10 Thread Mohitvermaji51
thank you for sharing with use

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread greenfork
Thanks a lot! I will try to reproduce everything and hopefully make it compile without hustle

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread b3liever
@enthus1ast for an simple (relatively) yet, efficient ecs implementation, I suggest you take a look at . It would be nice if someone ported it to Nim.

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread enthus1ast
> I don't know yet how nimterop works exactly me neither :), the raylib wrapper was my first nimterop project. Here is an raygui example (using my wrapper) import draylib import draygui const screenWidth = 800 const screenHeight = 450 SetConfigFlags(uint32 FLAG_

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread greenfork
Do you have a working example with raygui? I don't know yet how nimterop works exactly

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread enthus1ast
Both raygui and physac are header only, so no need to link to a library. For the gui i just had to enable the implementation: "DRAYGUI_IMPLEMENTATION"

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread enthus1ast
just checked, same goes for physiac: "-DPHYSAC_IMPLEMENTATION"

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread enthus1ast
Ah cool, did not know this lib, i'll give it a go. thank you!

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread greenfork
If you are looking for 2D physics engine, you might want Raylib's [physac](https://forum.nim-lang.org/postActivity.xml#physac). I plan to wrap it too once I understand how to generate good dll's for windows. It is the same story as with raygui, that I will need to compile physac as a dynamic lib

Any plans for syntactic sugar for parameter unpacking?

2021-01-10 Thread alexeypetrushin
It's very handy to have a shortcut for parameter unpacking/destructing as in code below. A tiny thing, but it's very useful. Any plans to have something like that in future versions of Nim? type Person = (string, string) proc hi((name, family): Person): string = "Hi " & nam

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread enthus1ast
I eventually swap out my wrapper with yours for my current project. Currently i polish the ecs. I'm still in search for a simple physic engine

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread greenfork
Sorry :D I've got bare bones wrapper in about 1-2 days and I've been polishing it for the next 4-5 days, hope you didn't spend too much time on it. If you have any ideas on what you would make differently, feel free to share, maybe we can come up with something good

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread enthus1ast
I guess greenfork's wrapper is better, mine is just bare minimum. But i've also written a small entity component system for my current project, if one cares :)

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread zetashift
Haha, that's...unfortunate!?

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread enthus1ast
Now this, why not 2-3 days earlier? :D ( )

Destructors vs ref object

2021-01-10 Thread enthus1ast
I've had the same question, i've solved it like this: type FooObj = object sss: string iii: int Foo = ref FooObj proc `=destroy`(comp: var FooObj) = echo "DESTRUCT: ", comp.sss proc testproc(sss: string) = var foo = Foo(sss: ss

Resize window events karax

2021-01-10 Thread b3liever
Maybe you can create a simple MWE, so people can experiment with.

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread b3liever
Thanks for caring!

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread b3liever
Thanks for caring!

Feedback request: todo.network

2021-01-10 Thread jasonfi
I've made my first Nim (Jester) web app publicly available (in beta): This is still in early development, but any feedback is welcome.

Resize window events karax

2021-01-10 Thread sdmcallister
I'm working with the eCharts library following the example in the karax experiments. I want to make the plot size dynamic and relative to the current browser window size which might change. If the browser window size is changed I need to resize the plot to fit the view. At the moment I have the

What's the preferred way to compile nim to WebAssembly?

2021-01-10 Thread wltsmrz
Some nim options to experiment with gc:arc noMain:on panics:on define:release define:noSignalHandler define:useMalloc Run These took me from: "env"."exit": [I32] -> [] "env"."getTempRet0": [] -> [I32] "env"."invoke_i

NimraylibNow! - The Ultimate Raylib gaming library wrapper

2021-01-10 Thread greenfork
Hello, my first library, hope you like it: This is an attempt to create the most idiomatic and up-to-date bindings for [Raylib](https://www.raylib.com/) which aim to be easy to use for entry-level programmers. It tries to solve following problems fro

What's the preferred way to compile nim to WebAssembly?

2021-01-10 Thread srbga
Ouch, I think wasm did not like the `env` parameter: int main(int argc, char** args, char** env) { } Run After manually removed `env` and re-run emcc, I got `out of memory` from wasm3 and this error from wasmtime 0.22: Error: failed to run main module

What's the preferred way to compile nim to WebAssembly?

2021-01-10 Thread srbga
Is it possible to disable features that needs longjmp (like exceptions)? Or rather, is there some kind of "minimal mode" in nim that calls as few system C functions as possible, at the cost of disabling some optional language features? If there is, I can directly work on that mode, if it's still

What's the preferred way to compile nim to WebAssembly?

2021-01-10 Thread srbga
Good progress: I added `--os:linux` despite the fact that I'm running windows. nim c -d:danger -d:emscripten --cpu:wasm32 --os:linux --compileOnly test.nim Run Then it compiles. The flag is already in `ng-public` but I thought I should not add it because I'm running wi

What's the preferred way to compile nim to WebAssembly?

2021-01-10 Thread srbga
Thank you! I don't completely understand it, but it certainly gave me some important info. I tried this: nim c -d:danger -d:emscripten --cpu:wasm32 --compileOnly test.nim Run Then go into the nimcache directory, rename `@mtest.nim.c` to `mtest.nim.c`, copy files to a

Google Summer of Code, Feb 19, 2021

2021-01-10 Thread mratsim
Just to mention that GSOC deadline is Feb 19, 2021 if we want to participate.

How to add a parameter based on a variable?

2021-01-10 Thread xigoi
What's the default value of `autofocus`?

How to add a parameter based on a variable?

2021-01-10 Thread jasonfi
I don't know, because Karax seems to generate code somehow, so there's no input proc to examine.

How to add a parameter based on a variable?

2021-01-10 Thread jasonfi
I assume I would use a template somehow? If my_var == true then add a parameter, otherwise leave it out. My use case is Karax, where autofocus = "" must be added to an input() call to add autofocus functionality. I don't want to write an if/else block and duplicate my input() code.

What's the preferred way to compile nim to WebAssembly?

2021-01-10 Thread ElegantBeef
I've personally never done it, but I do know [this](https://github.com/nikki93/ng-public) does it if you want a reference.

What's the preferred way to compile nim to WebAssembly?

2021-01-10 Thread srbga
Hi all! According to @elcritch in another thread I posted, it should be possible to compile nim to WASM, but I cannot get it done :( It looks like there is no built-in support for emcc and if I use config nim to use clang and compile nim to C sources, then use emcc to compile these C sources,

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

2021-01-10 Thread srbga
Ok! I'll wait for your changes because currently your codes are too hard to understand for me... I need to study nim more.

How to pass around large immutable data? Copy-on-Write?

2021-01-10 Thread ElegantBeef
I could be wrong but the NVRO doesnt kick in, simply cause the `StockPrices` type is not a big type, it's a fixed size of 16 bytes, so normal copy semantics are used instead of treating it as a reference.

How to pass around large immutable data? Copy-on-Write?

2021-01-10 Thread mratsim
StockPrices* {.shallow.}= object Run will avoid the double indirection involved in ref + strings or ref + seq