How do we preallocate string as element of array as this is..

2022-03-23 Thread sls1005
var bar = newSeqOfCap[array[2, string]](99) for _ in 1 .. 99: bar.add [newStringOfCap(999), newStringOfCap(999)] Run

How do we preallocate string as element of array as this is..

2022-03-23 Thread mardiyah
var bar: array[2, string] might be meant: var bar : seq[ array[2, string] ] ? ..then how

How do we preallocate string as element of array as this is..

2022-03-23 Thread demotomohiro
var bar: array[2, string] for i in bar.low .. bar.high: bar[i] = newStringOfCap(999) Run or var bar = [newStringOfCap(999), newStringOfCap(999)] Run

Read output only while input is not asked

2022-03-23 Thread demotomohiro
When `readLineTimeout` got timeout as it read output from `b.nim` and `b.nim` called `stdin.readLine`, `readStream.readLine` thread you spawned keep alive even when `readLineTimeout` returned and it can read output from `b.nim`. I that case, output read by that `readStream.readLine` call is not

Ruby's parallel-like functionality in Nim

2022-03-23 Thread sls1005
I think you're asking for template each(iter, v, body): untyped = for v in iter: block: let v = v spawn (proc() = body)() sync() [1, 2, 3].each num: echo num Run This also works: macro parallelEach(loo

How do we preallocate string as element of array as this is..

2022-03-23 Thread auxym
use `newSeqWith` fom the `std/sequtils` package

how to debug macros used with concept?

2022-03-23 Thread Dabod
Thanks for the example. But since I'm trying to wrap "class"es from C, I can't use `ref` and nim's own inheritance to provide type information to nim's type system. Also thanks The flexibility provided by nim's design allows for more solutions to problems.

How do we preallocate string as element of array as this is..

2022-03-23 Thread mardiyah
How do we preallocate string as element of array as this is for plainly a string: `foo = newStringOfCap( 999)` but needed it as inner string of `bar = newSeqOfCap[ array[ 2, string] ](99)` Thanks much in advance for helping

how to debug macros used with concept?

2022-03-23 Thread xigoi
Why should evaluating a macro that calls `echo` not produce output?

my TUI designer.

2022-03-23 Thread JPLRouge
I'm going to ask on discord french I have someone who made me a proposal.

server-client webframework

2022-03-23 Thread choltreppe
That looks intressting. ill defintly have a look at it when you release

server-client webframework

2022-03-23 Thread choltreppe
thanks. ill have a look at it

how to debug macros used with concept?

2022-03-23 Thread Araq
import macros macro isBaseType(t: typedesc): bool = let td = getTypeInst(t) assert td.typeKind == ntyTypeDesc var x = getTypeImpl(td[1]) if x.typeKind == ntyRef: x = getTypeImpl(x[0]) if x.typeKind == ntyObject: result = newLit(x.ge

my TUI designer.

2022-03-23 Thread juancarlospaco
English readme version would be a good improvement. :)

Ruby's parallel-like functionality in Nim

2022-03-23 Thread drkameleon
I've been a user of the Parallel gem () for a long, long time and I've always loved its simplicity and efficiency. (You may have a look into the README and I guess it shouldn't take you more than 3 minutes to figure out how this is to be used). What is the c

server-client webframework

2022-03-23 Thread nepeckman
I worked on a similar project a while back, no idea if any of my code is applicable for your purposes but feel free to copy anything helpful :)

server-client webframework

2022-03-23 Thread jasonfi
I'm working on a server/client framework myself, but with a Flutter engine on the client: I would like to release an initial code drop sometime next month.

server-client webframework

2022-03-23 Thread dom96
Looks amazing! Nim is definitely a language that needs something like this. Thank you for taking the initiative to build it :)

server-client webframework

2022-03-23 Thread PMunch
This looks really cool, it's one of those projects I've wanted to have a go at ever since I found Nim but never found the time to do.

multiple definition of NimMainInner

2022-03-23 Thread PMunch
This does indeed seem to be a bug, or at least something that hasn't been properly tested. IMO the `--nimMainPrefix` should apply to all the `*Main*` procedures (and probably `initStackBottomWith` as well, this would at least partially solve the issue. That being said most of the procedures gene

how to debug macros used with concept?

2022-03-23 Thread Dabod
I also try this template version, and it works as expect, but it slow down the compiler dramatically type Root = object Child = object base: Root Friend = object base: Root template base(_: typedesc[Root]): typedesc = void template base(

how to debug macros used with concept?

2022-03-23 Thread Dabod
I am trying to figure out why the latest 3 assertions can't get pass import macros type Root = object Child = object base: Root Friend = object base: Root macro hasBase[T: object; U: object](t1: typedesc[T]; t2: typedesc[U]): bool =

multiple definition of NimMainInner

2022-03-23 Thread mros
It is the same with this version: $ ../Nim-devel/bin/nim -v Nim Compiler Version 1.7.1 [Linux: amd64] Compiled at 2022-03-23 Copyright (c) 2006-2022 by Andreas Rumpf active boot switches: -d:release Run

multiple definition of NimMainInner

2022-03-23 Thread mros
No, I'm using `1.6.2`: $ nim -v Nim Compiler Version 1.6.2 [Linux: amd64] Compiled at 2021-12-17 Copyright (c) 2006-2021 by Andreas Rumpf git hash: 9084d9bc02bcd983b81a4c76a05f27b9ce2707dd active boot switches: -d:release Run I try the "devel" b