Idiomatic Nim code for 2D Poisson simulation

2021-07-08 Thread xigoi
Some things I noticed: * You should follow a consistent naming convention, preferably `camelCase`. So `newMat`, `maxAbs`, … for i in 0..

integrate with dll's procs that returns gced types

2021-07-08 Thread bung
variables pass to dll proc could be nil , in dll proc loop variable could be nil, get dll proc returns in main program could be nil.

Order of concept implementations and functions is significant?

2021-07-08 Thread Hlaaftana
First one works if you add `mixin eq` into `is_symmetric`. Entirely symbol resolution.

help Json

2021-07-08 Thread ynfle
How would you distinguish between variables and literals?

integrate with dll's procs that returns gced types

2021-07-08 Thread Araq
> I'v create a repo to demonstrate this problem. What is the problem?

Order of concept implementations and functions is significant?

2021-07-08 Thread Araq
I am not sure but please try our new concept implementation. :-)

Help with object serialization please!

2021-07-08 Thread treeform
The main problem you have is `DateTime`. Because the `DateTime` contains functions its very hard to serialize. What are you going to do serialize the assembly machine code of the functions? Huge security risk! If you instead use a `float64` timestamp or my `chrono` library you would not have th

Order of concept implementations and functions is significant?

2021-07-08 Thread stu002
Here's a simple concept and a function that makes use of the concept methods, which doesn't compile: type Eq* = concept x, y eq(x, y) is bool ne(x, y) is bool func is_symmetric*(x, y: Eq): bool = eq(x, y) == eq(y, x) func eq*(x, y: int): bool = x =

Idiomatic Nim code for 2D Poisson simulation

2021-07-08 Thread AboAmmar
Hi every body! This is my first day using Nim. I'm very excited by how nice and easy Nim is. After quickly skimming through the manual, I was able to translate this C code for 2D Poisson simulation: into Nim.

Cannot properly internationalize

2021-07-08 Thread tmsa04
xgettext with the option --language=Python works with a .nim suffix, there's no need to add .py.

how to export a prefix to an ref object type? (JSFFI)

2021-07-08 Thread Niminem
I think I came up with a hack.. it works but idk if it's the best way of doing things: wrapper: from dom import Node type Scene* = ref object Camera* = ref object of RootObj PerspectiveCamera* = ref object of Camera fov*,far*{.importc.}:

In the JavaScript backend how to pass a array back as sequence?

2021-07-08 Thread halloleo
Thanks for all the responses! It was my bad: I didn't evaluated the correct file in Nashorn. - Your assurances that the code is correct got my on the right track. :-)

Some problems trying to eliminate 'nil'

2021-07-08 Thread aleclarson
I'd expect a `{.noReturn.}` proc or `raise` statement within a `if foo == nil:` branch to work. Has this or will this be fixed?

Help with object serialization please!

2021-07-08 Thread Scotpip
Hi folks Newbie question here. I've figured out everything I need for my project except for one showstopping issue, and would very much appreciate a hand. I need a fast way to serialize and deserialize a seq of a relatively simple object to a binary file. The typical sequence will contain a few

how to export a prefix to an ref object type? (JSFFI)

2021-07-08 Thread Niminem
Hey guys, I'm taking a stab at wrapping the [three.js library](https://threejs.org/build/three.js) and ran into a problem... when declaring variables for various three.js objects and other types, I have to prefix them with `THREE` like so: `var scene = new THREE.Scene();` or `var renderer = ne

Safe `enum` conversion

2021-07-08 Thread planetis
> Nice! I'd probably go for a fusion-less version of that, fusion is difficult > to depend on in a larger project. Strong disagree, its a matter of doing `koch fusion` or `nimble install fusion`. Btw are you going to announce the results?

help Json

2021-07-08 Thread alexeypetrushin
By the way, wouldn't it be better to make quoted keys `"key": some` optional? And allow just `key: some`?

In the JavaScript backend how to pass a array back as sequence?

2021-07-08 Thread Hlaaftana
Have you considered checking the JS code output by the compiler?

In the JavaScript backend how to pass a array back as sequence?

2021-07-08 Thread juancarlospaco
Code is Ok.

Why do `del` and `pop` procedures of TableRef not guarantee operations in one attempt?

2021-07-08 Thread cblake
Documentation github pull requests are easier than average. I wholeheartedly recommend you learn to do those/start helping. The viewpoint of each new person is helpful, unique, and fading. Fair warning, docs for a deprecated dup key situation might be viewed as less valuable..

Why do `del` and `pop` procedures of TableRef not guarantee operations in one attempt?

2021-07-08 Thread exoticisotopic
The `del` and `pop` procedures of Table alse need multiple times of calls when `add` is applied with same keys multiple times. I would llike to commit a modification of comments below these two procedures of Table to avoid ambiguity. And after tests on OrderedTable and OrderedTableRef, I found t

help Json

2021-07-08 Thread Clonk
You can use [std/jsonutils](https://nim-lang.org/docs/jsonutils.html) for Json <-> Table conversion > Or you can drop `std/json` entirely and use the superior solution > [jsony](https://nimdocs.com/treeform/jsony/jsony.html)

redirect process's output to file

2021-07-08 Thread Clonk
First, since this question I've added dup and dup2 to `fusion/ioutils` : so you don't need to manually importc proc. Second, look at this : let process = startProcess(command, filePath, args, nil, options) let

Why do `del` and `pop` procedures of TableRef not guarantee operations in one attempt?

2021-07-08 Thread exoticisotopic
thx for explanation of the background

help Json

2021-07-08 Thread JPLRouge
Hello my program compiles but does not work in fact I would like to be able to make a table from panel including tables import json var jsonTest = %* { "titleTerm": "DESIGNER", "panel": [] } add(jsonTest["panel"], %* { "name": "TEST",

help Json

2021-07-08 Thread JPLRouge
in fact by exposing you my problem I found, the panel index was missing ex: add(jsonTest["panel"]|index]["button"]

redirect process's output to file

2021-07-08 Thread christianschoe
My account was new and it took a couple of days for an admin to give me the "user" status, so that this post is public. So maybe I have to draw some attention to it by replying to my own post...

Why do `del` and `pop` procedures of TableRef not guarantee operations in one attempt?

2021-07-08 Thread cblake
Well, as explained since most instances of `Table` do not have dups, `pop` would at least need a separate overload taking a `var seq`, and the idea came up for `del`, but people decided they preferred to instead just deprecate dup keys. So, why did this feature not exist for 13 years to relieve

Why do `del` and `pop` procedures of TableRef not guarantee operations in one attempt?

2021-07-08 Thread exoticisotopic
I think I misunderstood the term 'added' in the doc after @timothee explained that multiple deletes are only needed in case of the `add` procedure applied on a TableRef which eased my concern about the practical usage of TableRef. But I'm still wondering why `del` and `pop` procedures of Table d

Why do `del` and `pop` procedures of TableRef not guarantee operations in one attempt?

2021-07-08 Thread cblake
Rampant misuse (if it is common) may be a choice forcing argument. This misuse comes from lack of attention to docs for which there is another solution - better/more attention-getting docs Re: surprising features. That could be attempted before removing old functionality. FWIW, my vague recolle

In the JavaScript backend how to pass a array back as sequence?

2021-07-08 Thread xigoi
The code you gave seems to work correctly, and so does this: proc give3(val: cstring): seq[cstring] {.importc: "give_me_three".} Run What's the problem?

In the JavaScript backend how to pass a array back as sequence?

2021-07-08 Thread halloleo
I have a JavaScript function which returns an JavaScript array, e.g. function give_me_three (dummy) { return ["one", "zwei", "trois"] } Run How can I call this function in Nim? I all sorts of ways to make it work, the best (I think) is: proc gi

Why do `del` and `pop` procedures of TableRef not guarantee operations in one attempt?

2021-07-08 Thread Araq
> So, while one could view it as "choosing ones battles", in this case nothing > was forcing that choice. Many people used `add` by accident. Now that could have been fixed by using a different name like `addAllowForDuplicate` but then the implementation of `del` (and actually every other opera