Can Nim do Type States?

2023-03-10 Thread shirleyquirk
I think Zig would be more aligned with that ethos of no-surprises, no code generation. Nim is never going to be that. I came to Nim for embedded because my philosophy is: having code that's written at the right level of abstraction is how to write comprehensible code, and clear, comprehensible,

Can Nim do Type States?

2023-03-10 Thread AMoura
The DO-178 standard was mainly defined for the C language and I don't think it is strictly applicable for other languages ​​like Nim.

Can Nim do Type States?

2023-03-10 Thread Araq
`malloc` is very different from "meta programming" though, `malloc` is all about runtime flexibility (allocation of unknown sizes with unknown lifetimes), meta programming is about raising the level of abstraction so that programs become shorter. Not that "meta programming" means much anyway. B

Fstring and Split to Variable Error

2023-03-10 Thread Naterlarsen
Thanks, that solved the problem! import strutils var names = "nate@john@sally" let name_list = names.split('@') let name1 = name_list[0] let name2 = name_list[1] let name3 = name_list[2] echo name1 echo name2 echo name3

Fstring and Split to Variable Error

2023-03-10 Thread Hlaaftana
`let splitData = mydata.split("@", 2) let (newname, newsize) = (splitData[0], splitData[1]) ` Run

Fstring and Split to Variable Error

2023-03-10 Thread Naterlarsen
There must be a way to save to values and separate them with a character such as @ then after sending it via sockets to the client to split it and extract those values. variable1@variable2 newvar, newvar2 = variable.split("@")

Fstring and Split to Variable Error

2023-03-10 Thread Nlits
Well, split does not return a tuple, it returns a seq. So it can return any amount, and cannot ensure that it would be two. Also, `echo "Enter a file's path > " let file_path = readLine(stdin)` should not be together on the same line

Fstring and Split to Variable Error

2023-03-10 Thread Naterlarsen
Here is my working python code that Im trying to replicate in nim. Getting an error. Working python code - #Collect information from user input. old_file_name = input("Enter the path and name of the file name to change >") new_file_name = input("Enter the new file name >") #Create an fstring

Template in template: should this work?

2023-03-10 Thread geotre
May be useful -

Number of requests issue with Httpbeast

2023-03-10 Thread radsoc
When load testing Httpbeast and its new request id, I noticed a difference between the number of requests generated by wrk (same results with hey/oha) and the last id generated by Httpbeast. You can test a similar issue with the current Httpbeast release (v0.4.1) and this short `helloHttp.nim`

Can Nim do Type States?

2023-03-10 Thread dwhall256
> | My line of work prohibits metaprogramming > > What does this mean? I work in embedded, too, not like, misra-level or > anything but I've never come across any restrictions limiting the level of > abstraction. Wouldn't mplab/harmony/all those code configurators from > microchip count as meta

Nested macro expansion order

2023-03-10 Thread auxym
Yes, macros are expanded "outside in". That is, the outermost macro is evaluating. Then, if the resulting AST contains more macros (or templates), they are evaluated, and the process continues like this recursively.

Template in template: should this work?

2023-03-10 Thread Hlaaftana
Well for one the signature of `bar` in your example is `(string, untyped)` and you are only giving the `untyped` parameter. But beyond that this really depends on the DSL at hand. For macros that take `untyped` parameters (seemingly like `buildHtml`) template evaluation will not necessarily be

Nested macro expansion order

2023-03-10 Thread nimnam
Can you use a macro in a macro? like macro sqr(x: typed): quote: `x * x` macro do(): quote `sqr(2)`

Template in template: should this work?

2023-03-10 Thread moigagoo
I'm working on component system for Karax as part of my Sauer tool. One of the things I want to standardize are container components: the kind of components that have content in them. Like a panel or a layout. My approach is that a component exposes a `render` template that accepts a code block

Version 1.6.12 released!

2023-03-10 Thread avandy
Thanks!

Version 1.6.12 released!

2023-03-10 Thread ringabout
There is probably something wrong with `choosenim stable` (probably the server channel hasn't been updated). Try `choosenim 1.6.12`, which works for me.

Version 1.6.12 released!

2023-03-10 Thread avandy
Can not update. Info: Already up to date at version 1.6.10

Can Nim do Type States?

2023-03-10 Thread shirleyquirk
@dwhall > My line of work prohibits metaprogramming What does this mean? I work in embedded, too, not like, misra-level or anything but I've never come across any restrictions limiting the level of abstraction. Wouldn't mplab/harmony/all those code configurators from microchip count as meta

Version 1.6.12 released!

2023-03-10 Thread Isofruit
Nice to hear of progress being made towards nim 2.0 and nice to see a new release! Also huge thanks to you ringabout for the work you're investing towards evading windows antivirus shenanigans!

Version 1.6.12 released!

2023-03-10 Thread ringabout
One of the important fix in this release is that it avoids using old API on Windows, which might improve the false positive situation on Windows =>

why use nim over c#?

2023-03-10 Thread grd
Wow

Can Nim do Type States?

2023-03-10 Thread giaco
Interesting topic. If the target is to guide the user toward correct use of an API, can Nim 2.0 effect system help in this direction?

Version 1.6.12 released!

2023-03-10 Thread Araq
More information here: And version 2.0 is 2 show-stopper bugs from being done:

Can Nim do Type States?

2023-03-10 Thread ElegantBeef
Yes `static` data types are not included in the type at runtime. To elaborate further though with huantian's example we can disable the `=copy` hook to make it so you init a config and only ever have a single owner as follows: import std/[options, macros] type Directi