tutorial to clone c++ library

2021-08-23 Thread Kalbhairab
i found a c++ ui library that runs in android, ios, windows, mac, linux named Run which has Its core dll less than 1.5Mb and uses html like syntax. Also it is MIT licensed. But i cant find any tutorial to clone c++ library in nim. If anyone has any tutorial please provide link.

Dialog-Based Win GUI

2021-08-23 Thread AIR
I couldn't find any posts covering Dialog-Based WinGUI apps, so I decided to play with it. Using ResEdit and windres, I didn't have to code any of the GUI objects. Example is in this repository: [Demo](https://github.com/Airr/Nim-Dialog-Based-Win-GUI) I looked into this in response to several

Nested macro expansion order

2021-08-23 Thread haxscramper
If `foo` has `typed` argument then `bar()` is evaluated first and then resulting AST is passed as argument. Note that `bar`'s output AST would be **fully** expanded before being passed to `foo` macro bar(): untyped = newLit("bar-expanded") macro foo(arg: typed) = echo arg.t

Nested macro expansion order

2021-08-23 Thread apardes
Is there any way for a macro to expand nested macros during its evaluation? For example, if there are macros foo(x) and bar() and we write: foo(bar()) Is it possible for foo to access the AST which would be generated by bar?

heap mgr improved?

2021-08-23 Thread Araq
You can simply use `ptr T`, destructors and custom memory management...

How can I export module by name?

2021-08-23 Thread alexeypetrushin
Yes, thanks, I missed the visibility sign `*` in the example, of course it should be present.

How can I export module by name?

2021-08-23 Thread Stefan_Salewski
I think your first issue is that read() is not exported at all. I would assume that "export fs" can work at all only with proc read*() with export marker.

How can I export module by name?

2021-08-23 Thread alexeypetrushin
After thinking, it's possible to rewrite `fs.nim` as code below, and get the desired effect type FS* = object const fs* = FS() proc read(fs: FS, path: string): string = "content of some file" Run

How can I export module by name?

2021-08-23 Thread alexeypetrushin
Module `fs.nim` proc read(path: string): string = "some content" Run Module `base.nim` from ./fs import nil # I want only the fs namespace to be exported, not its content # export fs as fs - this doesn't work export fs Run M

WriteLine end the line by \n Why not by \p (platform specific)

2021-08-23 Thread Araq
This came up quite a bit when we introduced `\p` and IMO defaulting to `\n` (LF) is usually most convenient, even on Windows machines: All the tools understand LF perfectly fine these days and copying files over to Macs/Linux then does not cause incompatibilities.

Nim stability problem, change imports slightly, and you program is broken

2021-08-23 Thread Araq
Thanks. You should really use objects, not tuples for these things. The compiler re-uses generic instantiations for "identical" tuples.

WriteLine end the line by \n Why not by \p (platform specific)

2021-08-23 Thread FabienPRI
Hi all, Not sure to be right but it seems that on Windows WriteLine end line by a n, which is not aligned with platform convention. May be it should be better to end by p which is platform specific, cn on Windows. May be I missed something and it is not the good function to write lines in a t

The correct way to use 'collect' as a function argument

2021-08-23 Thread puruneko
I see. It means that Nim thought it was a combination of a constructor and a named tuple, not a function call, doesn't it. (I don't know why they don't consider it a function call) I can use `collect(newSeq) do:` to do what I want to do, so solved my problem. Thank you very much.

The correct way to use 'collect' as a function argument

2021-08-23 Thread Hlaaftana
Nim thinks `toString(collect(newSeq): etc)` is an object constructor with `toString` as the type, `collect(newSeq)` as the name of one of the fields of that object, and `for aa in a: aa * 2` as the value of that field. If you change it to: var c = toString( (collect(newSeq)

heap mgr improved?

2021-08-23 Thread rforcen
the only solution i've found is: 1. rethink heap mrg. in 'nim way' 2. careful dealloc created memory