Re: Globally-invoked macros

2018-07-21 Thread Quelklef
I'm not sure, but your example as given does not compile.

Re: Globally-invoked macros

2018-07-21 Thread rayman22201
Quelklef and I discussed this a bit on IRC. I have mixed feelings about it. But I do think it is worth making an RFC for. The most well known example of a similar feature that I have seen is Racket, which lets you have module level reader macros. (@Quelklef, I was finally able to find the name

Re: On exceptions (again)

2018-07-21 Thread rayman22201
> I think it's a mistake to chase every feature it has when we are so early to > a 1.0 release I don't know what Araq's plans are, but I never thought that this was a 1.0 feature? I thought we were just discussing the idea as a valid RFC to put on the roadmap. I agree that getting 1.0 finished

Re: NEWBIE - generics issue

2018-07-21 Thread gemath
Ah, so _strategy_ could never be _static_ but you would select it at will by passing a _SpecialisedTA /B_ to fill. Took a while, but I think I get it now :o) > I am merely stating my ignorance here :-). This is Nim, so that's what we're all doing here to a degree, with a few exceptions.

Welcome to the new Nim programming language forum

2018-07-21 Thread dom96
I have tagged and deployed NimForum 2.0.1 yesterday. This is a very minor release. The two main improvements are: * The forum now runs on Jester 0.4.0 and HttpBeast 0.2.0. * User sessions are no longer tied to your IP address. So for those of us on the go, or with an ISP that likes to

Re: On exceptions (again)

2018-07-21 Thread dom96
I do want Nim to compete with Rust. I think it's a mistake to chase every feature it has when we are so early to a 1.0 release. Even if Nim gets rid of GC and exceptions, Rust will have had a large lead on Nim. We need to distinguish ourselves from Rust, not copy its every feature. By chasing

Re: NEWBIE - generics issue

2018-07-21 Thread LeuGim
`when` is resolved at compile-time, at run-time you get just one of two branches, which already knows what field to read from JSON and where to put it. So if you explicitly pass strategy (type disambiguator) as compile-time known (static) argument, a proc with `when` is the simplest and most

Re: NEWBIE - generics issue

2018-07-21 Thread yatesco
Hi @gemath. The types are known at compile time, but they are being populated by a JSON file at runtime, so doIt would be called multiple times at runtime and will take in a JsonNode. I am not challenging your assertion about compile times, so the above might still be possible? I am merely

Re: NEWBIE - generics issue

2018-07-21 Thread gemath
> runtime dispatch uses dispatch trees which are more performant than the more > common indirect branches Don't quite understand your decision: the types seem to be known at compile time and nothing is faster than compile time dispatch. So, the solution by @mratsim should be fine. Btw., if you

Re: Exceptions don't work in function

2018-07-21 Thread mratsim
Illegal storage access, is equivalent to nil pointer dereference in Nim, it is not an exception. Checking the code of writeData: proc writeData*(s, unused: Stream, buffer: pointer, bufLen: int) {.deprecated.} = ## low level proc that writes an untyped

Re: string literals should not allocate; should allocate in ROM an extra `\0`

2018-07-21 Thread Araq
Yeah, we really need to fix that. :-)