Nim for mobile

2023-04-18 Thread kragil
Has the nim mobile dev story made any progress in the last 3 years?

Type mismatch with echo and trouble accessing Type fields

2023-04-18 Thread sls1005
> I'm not super sure why I need to add the square brackets on add. `[]` is the dereferencing sign, similiar to `*` in C.

Design discussion for KommandKit - async, multithreaded, ORC-ready web framework

2023-04-18 Thread termer
One other thing, I know that user and library-defined middleware will want to expose data to request handlers, so for that, I opted to use a Table of boxed values that can be accessed by handlers. This allows handlers to write data using a string key, and then retrieve them if they know the type

Design discussion for KommandKit - async, multithreaded, ORC-ready web framework

2023-04-18 Thread termer
Over the past several days I've been working on an HTTP framework called [KommandKit](https://git.termer.net/termer/KommandKit). It's built on top of `microasynchttpserver` by @pwernersbach which provides an `asynchttpserver`-compatible server but with low-level control over streams and much, m

State of HTTP Servers in Nim

2023-04-18 Thread termer
As @ingo said, I'm thinking about having an event bus to implement the actor model. I take a lot of inspiration from Vert.x from the JVM world, which is what I use and have used in many projects successfully. There are mini-applications called Verticles in that framework which all have access t

Type mismatch with echo and trouble accessing Type fields

2023-04-18 Thread ElegantBeef
Like I said ref's do not have a `$` defined and when the default `$` for objects is called it replaces shows `...` for the output. This can be seen in the following aswell type NotInt = distinct int echo (NotInt(10), ) Run You need to implement your own `$` to cha

Type mismatch with echo and trouble accessing Type fields

2023-04-18 Thread FluxCapacitor
Thanks. What I'm seeing is that: echo add[] prints: (left: ..., right: ..., op: "+") Run but echo add.left[] just prints: () Run

Type mismatch with echo and trouble accessing Type fields

2023-04-18 Thread Yardanico
That's because `add.left` is an Expr, and your expr is just `Expr = ref object of RootObj` \- an empty object without any fields.

Type mismatch with echo and trouble accessing Type fields

2023-04-18 Thread ElegantBeef
There is no `$` defined for `ref` types so you have to dereference the pointer to print them, or write your own `$` for them.

How to inverse set?

2023-04-18 Thread cblake
The name in mathematics is ["set complement"](https://en.wikipedia.org/wiki/Complement_\(set_theory\)) not "inverse" and there is a func in a stdlib module for this: import std/setutils echo complement({'a'..'z'}) Run

Type mismatch with echo and trouble accessing Type fields

2023-04-18 Thread FluxCapacitor
Hi there, I'm very new to Nim. I have some code: type LitKind* = enum NumLit, StrLit, NilLit, BoolLit LitType* = object case litKind*: LitKind of NumLit: n*: float64 of StrLit

Article on wrapping C libraries in Nim

2023-04-18 Thread adokitkat
I would like to automatize creating a wrapper for ESP-IDF (framework for ESP32 programming based on FreeRTOS and full of macros). I would like to achieve a similar thing to [nesper](https://github.com/elcritch/nesper), but automatically generated so it doesn't have to be manually checked and fix

How to inverse set?

2023-04-18 Thread shirleyquirk
> P.S. The char set is stored as 256 bit vector right? Yes, `sizeof({'a'..'z'}) == 32` But `sizeof(set['a'..'z']) == 4`

How to make os (e.g. ubuntu) interpret nimscript shebang

2023-04-18 Thread Araq
> The nim executable has no extension. Depends on the OS, for me it has an `.exe` extension. And now tell your .gitignore to ignore produced binary files because they are artifacts of compilation and fundamentally different from hand written scripts. Oops.

How to make os (e.g. ubuntu) interpret nimscript shebang

2023-04-18 Thread shirleyquirk
> two or more arguments in shebang might not be accepted by the system or > shell, Yes, that's what the `-S` is for, it lets you pass multiple arguments

How to make os (e.g. ubuntu) interpret nimscript shebang

2023-04-18 Thread sls1005
>From : > On Unix, you can also use the shebang #!/usr/bin/env nim, **as long as your > filename ends with .nims** Missing an `e` is correct. However it only works on files prefixed with `.nims`, otherwise it gives "Error: invalid command: ...". Also I've h

Article on wrapping C libraries in Nim

2023-04-18 Thread cmc
Intriguing. Did you have to deal with a build system to get CoAP working?

Article on wrapping C libraries in Nim

2023-04-18 Thread PMunch
It should only include the parts used by your program which Nim needs to be able to properly type everything. When you use `path` in your importc block everything from that path which is included will generate bindings, if you use `sysPath` the path will be searched but no bindings will be gener

Article on wrapping C libraries in Nim

2023-04-18 Thread adokitkat
Hello! Thank you for your work. Is it possible to separate generated bindings to different files based on header `.h` files? I am trying to use Futhark on ESP-IDF but the the generated `.nim` file/bindings from one header file also contains all of the dependencies from `#include "..."` included

How to inverse set?

2023-04-18 Thread PMunch
Yes, you have this

How to inverse set?

2023-04-18 Thread adokitkat
You can do something like: let u8 = {char(0)..char(255)} let s = {'a'..'z'} echo u8 - s Run

How to inverse set?

2023-04-18 Thread alexeypetrushin
Is that possible? let s = {'a'..'z'} echo s.inverse # ? Run

Which might be the best way to store complex data in MySQL

2023-04-18 Thread cmc
Personally I usually do stuff like that normalized to a database. Structured data you can mutate one-by-one is kind of the definition of what a relational database is supposed to do. I like tiny_sqlite a lot because it neatly maps type information without doing strings, and it's in-process- no s

Which might be the best way to store complex data in MySQL

2023-04-18 Thread nimnam
I wrote a library in TypeScript which stores patch sets (changes of values based on keys). So a document is a final states (key value array) and a changelog. I use JSON(P) because because PG and TS can easily handle it. Now Nim can handle JSON but you loose all typing guarantees. Using Nim data

State of HTTP Servers in Nim

2023-04-18 Thread ingo
With a bus, like [Cherrypy](https://cherrypydocrework.readthedocs.io/extend.html#server-wide-functions)? Using `asyncstream` one can bolt all kind of things together.