Generics / function overloading for imported function

2021-08-24 Thread trisub
Thank you very much, that was exactly the piece of information I was missing! Also, I see now that it's right in the documentation: On a sidenote: yeah, I know about `quote` from `std/macro`. I don't need a `quote` function like i

Generics / function overloading for imported function

2021-08-24 Thread xigoi
In addition to what @shirleyquirk said, if the function you're defining sees multiple implementations of `quote`, it automatically becomes an open symbol, so that's why the seemingly unrelated definition caused a difference. Also, be careful with the name because there's a `quote` macro in `std/

Generics / function overloading for imported function

2021-08-24 Thread shirleyquirk
[play](https://replit.com/@shirleyquirk/AgitatedWhirlwindPreprocessor) [mixin](https://nim-lang.org/docs/manual.html#generics-mixin-statement)

Why does this, while incorrect, iterator( code always result in a crash of the playground?

2021-08-24 Thread ElegantBeef
It's a non terminating loop it shouldnt crash a proper instance since it has a purpose(video game main loop for instance). It's exactly the same as `while true: discard`. The loop never ends so the containers timeout kicks in and says "Kill this" which is why you dont get a response.

Why does this, while incorrect, iterator( code always result in a crash of the playground?

2021-08-24 Thread mareklachbc
Thanks for pointing this out. In that case, if an infinite loop is detected, does the _proper_ /desktop compiler also crash, or does it stop at some point and gives a warning about a possible infinite loop occurring before a crash would happen to prevent it?

How to make Nim more popular

2021-08-24 Thread Dan
Nim would attract some attention if it had GUI maker with practical examples(desktop(linux, windows), mobile).

Generics / function overloading for imported function

2021-08-24 Thread trisub
Hello, I have a question concerning generics / function overloading. Say I have a (somewhat silly for demonstration purposes) "module A". The main function `quotedPair` takes an argument and returns a tuple containing the argument itself as well as some sort of "quoted" form of the argument whi

How to make Nim more popular

2021-08-24 Thread juancarlospaco
> Python has one packed with itself Almost no one codes Python with Idle.

Why does this, while incorrect, iterator( code always result in a crash of the playground?

2021-08-24 Thread sky_khan
Yes, you have an infinite loop here because i is always smaller than sum : while i < sum: inc i, 1 inc sum, i echo "i:" & $i & " sum:" & $sum# you may add this to see it yourself. Run So, It never finishes looping and it can not send a response in

How to make Nim more popular

2021-08-24 Thread alexeypetrushin
> Better code-editor support would go a long way as a barrier to entry, > however, it seems that many such projects, like > , and even the semi-official > now lay abandoned. I can hardly imagine anyone abandoning VS Code / Vi

undeclared field: 'mimes' for type mimetypes.MimeDB

2021-08-24 Thread ingo
Thank you. Missed the star. I can work around it by first getting all the audio mimes from `mimes` and then add the new ones to that stringTable.

How to make Nim more popular

2021-08-24 Thread mareklachbc
Better code-editor support would go a long way as a barrier to entry, however, it seems that many such projects, like , and even the semi-official now lay abandoned. Yes there are plugins for popular editors which is great, bu

undeclared field: 'mimes' for type mimetypes.MimeDB

2021-08-24 Thread pointystick
The MimeDB ref object is declared as follows in mimetypes.nim: type MimeDB* = object mimes: StringTableRef Run The 'mimes' in the object doesn't have an export marker (an asterisk) so it's not visible to your code. There's a separate 'mimes' constant just

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

2021-08-24 Thread FabienPRI
It is your opinion, but it could be understand as I don't care of Windows users (I stay polite). IMHO not a good message for a language that aims to be multi OS friendly. And there are a lot of (maybe bad) tools remaining used in the huge liste of Dos / Windows softwares still used by companies

undeclared field: 'mimes' for type mimetypes.MimeDB

2021-08-24 Thread ingo
The code below results in the error: Error: undeclared field: 'mimes' for type mimetypes.MimeDB [declared in ...] found 'mimes' of kind 'const' Run I do not understand why and see no way out. import mimetypes from strutils import toLowerAscii

Why does this, while incorrect, iterator( code always result in a crash of the playground?

2021-08-24 Thread mareklachbc
I'm still new to learning programming in general, and experimenting with Nim in particular, so I understand that this code is wrong and incorrect for the _Nim_ compiler that powers the playground (the C compiler in this case it seems) : `` iterator count(sum: int): int = var i = 0 var sum =

heap mgr improved?

2021-08-24 Thread Araq
> are seq[ptr T] items deallocated when seq is destroyed? No, they are not. A `ptr` is not an owner of data.

distrying seq[ptr T] field

2021-08-24 Thread rforcen
having type Foo = object ps : seq[ptr int] proc `=destroy`(foo: var Foo) = for p in foo.ps: p.dealloc foo.ps = @[] proc newFoo(n:int) : Foo = result = Foo(ps:newSeq[ptr int](n)) for i in 0..

heap mgr improved?

2021-08-24 Thread rforcen
yes, that's what i'm currently doing, just using a seq[pointer] to store all create calls and finally free then at object destroy, the problem with this solution is that it's not elegant and only supports one object at the time