To `ref` or not to `ref` on embedded?

2022-09-24 Thread elcritch
I've used ref objects on embedded and it can be fine and very convenient even. Prefer a acyclic with ARC. Partly though it depends on how much RAM you have. Here's some rules of thumb I've found: * <16kB of free ram use very sparingly * the allocator means you'll only be able to use a smal

Pygments Nim lexer update?

2022-09-24 Thread matkuki
If you check the `git` log, there was nothing changed in the example `Nim` code files `example.nim` and `test.nim`. This is a left-over from the `Nimrod` days, when there was full case insensitivity. They even still call it `NimrodLexer` for compatibility.

Pygments Nim lexer update?

2022-09-24 Thread Yardanico
Was there a reason as to why you changed some of the `echo` to be `Echo`? Maybe you got confused by the Nim syntax a bit, but in Nim `echo "hello"` and `echo("hello")` mean the exact same thing and call the exact same built-in proc. `Echo("something")` wouldn't work because Nim is case-sensitive

Pygments Nim lexer update?

2022-09-24 Thread matkuki
`Nim` lexer for `Pygments` updated:

To `ref` or not to `ref` on embedded?

2022-09-24 Thread demotomohiro
I wrote about differences of 'ref object' and plain 'object' before:

To `ref` or not to `ref` on embedded?

2022-09-24 Thread arnetheduck
+1 - the simple advice is to never use `ref object` unless semantics demand it - then the caller can decide if they want a `ref Type` or not and type it out

To `ref` or not to `ref` on embedded?

2022-09-24 Thread auxym
Most people will avoid refs (and dynamic heap usage in general in embedded) because of the associated runtime cost, the difficulty in predicting memory usage on these constrained systems, and the risk of heap fragmentation. That said, use them sparingly if you have to, and you know the limits of

Formatting a float to currency

2022-09-24 Thread leidalinck
Unfortunately, hardly many bookmakers now provide profitable wagers on cybersports. I have been playing on loki casino mobile for a very long time. I would strongly advise checking at the URL I provided above if you're seeking for a reputable bookmaker with a big selection of well-liked games.

update dictionary value function?

2022-09-24 Thread cblake
With `std/tables` you can also use `mgetOrPut` with a small helper proc to do the update as in `t.mgetOrPut(key, initial).edit(args)` with a `proc edit(cell: var V, args)` (where `args` here will depend on your use case). You may also consider an `editOrInit` which takes a `found` & `missing` cl

To `ref` or not to `ref` on embedded?

2022-09-24 Thread BarrOff25
Hello I want to do some project on an arduino board. Writing some code I started thinking about whether using `ref` objects or not makes sense for embedded targets? What are the pros and cons of each option?

update dictionary value function?

2022-09-24 Thread drkameleon
I think @Yardanico's answer nailed it. I'll try it out, but - judging from its implementation - I think that's exactly what I've been looking for. My problem with @asteroid_den's approach is that there are 2 lookups (one for `k in t` and another one for `t[key]=`). And that's exactly what I'm tr

update dictionary value function?

2022-09-24 Thread Yardanico
If you don't mind it being a template, then works, but its implementation is kind of hacky.

update dictionary value function?

2022-09-24 Thread asteroid_den
There's no such `proc` in `std/tables` because it's rarely needed

update dictionary value function?

2022-09-24 Thread asteroid_den
proc editIfExists[A, B](t: Table[A, B], key: A, val: B) = if key in t: t[key] = val Run

update dictionary value function?

2022-09-24 Thread drkameleon
Basically, I'm in the process of writing a more-specific hash table implementation, based on the existing one, but more tailored to my needs and with some functions that I consider "missing". I'm not sure whether I'll end up using it in the end, but I'm still trying different things out. One o