Re: Some problems trying to eliminate 'nil'

2020-05-07 Thread Hlaaftana
You are not supposed to use `not nil` types as Option generic parameters, Options check if a type is ref or ptr or proc then assume their nil values to be `None` instead of using an extra bool discriminator, so `some(nil)` is also disallowed. You used `Option[Foo]` where `Foo` is not nil. There

Re: I cannot understand ARC

2020-05-07 Thread Araq
> So, I'll ask now. I think the primary reason is different API design.

Re: Semantic grep, a very cool idea (currently mostly for Python)

2020-05-07 Thread timothee
these 2 cmd line tools are relevant * nimfind * nimsuggest * this PR [https://github.com/nim-lang/Nim/pull/12076](https://github.com/nim-lang/Nim/pull/12076) allows a library solution to find declarations: allows showing where a symbol is defined (works with all symbols) eg:

Re: I cannot understand ARC

2020-05-07 Thread bpr
@Araq I appreciate all of the work done by you and others, and I think a cycle collector is useful even without async. That said, you know that some will ask "Why does Nim async need a cycle collector when Rust/C++ async does not?". So, I'll ask now. Still looking forward to the day when I can

Re: Cast float64 to sequence of bytes and cast sequence of bytes to float64

2020-05-07 Thread Stefan_Salewski
See [http://ssalewski.de/nimprogramming.html#_casts_and_type_conversion](http://ssalewski.de/nimprogramming.html#_casts_and_type_conversion) first. Then it should be easy to cast a float to an array of 8 bytes and back. And when you have a seq containing exactly 8 bytes, then you can copy the 8

Cast float64 to sequence of bytes and cast sequence of bytes to float64

2020-05-07 Thread dataPulverizer
How do I cast float64 to sequence of byte`s and cast sequence of `byte`s to `float64? float64 is just an example it could be any basic type. I already did it for an array, but don't know how to do it for a sequence. Thanks

Some problems trying to eliminate 'nil'

2020-05-07 Thread snej
I'm just getting started with Nim, and really loving it. (My background is mostly C++ and Objective-C, but I've spent time in Java, Swift, Python, Ruby, Smalltalk-80, and I'm currently also learning Rust.) I'd like to use a more Rust/Swift/etc. style where `nil` is not allowed. It looks like th

Re: I cannot understand ARC

2020-05-07 Thread Araq
@bpr Given that I spent months on the problem, then gave up and worked on `--gc:orc` (with much better progress), it's anything but a "temporary implementation detail". But one can write new async implementations that work with pure ARC. Whether that's important or not remains unclear, I _might_

Re: I cannot understand ARC

2020-05-07 Thread bpr
Is the need for a cycle collector with async a temporary implementation detail, or is it something that will be fixed in a future async?

Re: I cannot understand ARC

2020-05-07 Thread zetashift
FWIW, I found the talk about ARC during FOSDEM to be a nice resource as well: [https://fosdem.org/2020/schedule/event/nimmovesemantics](https://fosdem.org/2020/schedule/event/nimmovesemantics)/

Re: Making 4k intro with Nim

2020-05-07 Thread treeform
I really liked the write up. Thank you for this!

Re: Unicode support for Windows 10 console

2020-05-07 Thread doongjohn
I think I soved this issue(?) # winconsole.nim when system.hostOS == "windows": import std/winlean import std/unicode proc readConsoleW(hConsoleInput: Handle, lpBuffer: pointer, nNumberOfCharsToRead: int, lpNumberOfCharsRead: pointer, pInputControl:

Re: I cannot understand ARC

2020-05-07 Thread dom96
> "Compile your code with --gc:arc". That's it, the rest are details, the > document describes how --gc:arc is implemented. Don't you need to at least mention `--gc:orc` as well? The difference between them at least is useful knowledge, since as soon as someone compiles async code with `--gc:ar

Re: I cannot understand ARC

2020-05-07 Thread Araq
This document is the spec we follow in our implementation and it served us well for this purpose. It's not for end users (but then it's also not meant to be incomprehensible either :-/ ), we'll have an ARC tutorial soon, I hope. Here is the summary: "Compile your code with --gc:arc". That's it,

I cannot understand ARC

2020-05-07 Thread andrea
I am trying to understand ARC, which seems to be promised as the future for Nim. That, in turn, redirects to [this document](https://nim-lang.org/docs/destructors.html), so I am reading that, but I cannot make head or tails of the whole document. It starts with a motivating example, which I can

Re: copy & move Access is Denied

2020-05-07 Thread Araq
Well we use the Win API directly for `copyFile` so every inconsistency is Microsoft's fault. :-)

is `tyOpt` still used?

2020-05-07 Thread timothee
my understanding is that this Builtin optional type is dead code and should be removed, which matters a lot because TTypeKind.high == 63 I'd like to add a new TTypeKind without making set operations on types slower (although this should be benchmarked to see if it matters or not)

Re: is `tyOpt` still used?

2020-05-07 Thread Araq
It's not used, feel free to remove/replace it.