Re: Compile-time type reflection API?

2018-03-16 Thread chrisheller
Keep in mind that you can write some of your own compile time methods if (for example) you're regularly checking for something in the AST.

Re: Compiler won't scale (still)

2018-03-16 Thread Araq
> I'm also reached this limit before, but avoided it by simplifying > compile-time code. Alright, I take it back. BTW `let` instead of `const` for computed lookup tables is also an option.

Re: Compile-time type reflection API?

2018-03-16 Thread Araq
Depends, but not really. An object does not only consist of fields, it can have `case` and `when` etc.

Re: Compiler won't scale (still)

2018-03-16 Thread xomachine
I'm also reached this limit before, but avoided it by simplifying compile-time code. You may try to find a way to reduce number of function calls per loop iteration to fit the limit.

Re: Compiler won't scale (still)

2018-03-16 Thread Araq
1. It is perfectly feasible to write a Nim program that outputs an array literal as a string. The compiler supports this out of the box with `staticExec` and its caching mechanism. No need for Ruby. 2. You're the first person on earth that did run into this limit of Nim's VM, afaict anyway.

Re: Compiler won't scale (still)

2018-03-16 Thread StasB
> I could use Ruby to create all the parameters and dump them into a file too, > which would be easier. You could, couldn't you? It does sound better than doing this: > displayed to terminal, copied, pasted into an editor, line formatted, copied, > then pasted the formatted array values into

Re: Compiler won't scale (still)

2018-03-16 Thread jzakiya
I could use Ruby to create all the parameters and dump them into a file too, which would be easier. **I Don 't want to jump through extra HOOPs because the Nim compiler is deficient!!** I don't have to do this in C++. The compiler should work for the human, not the other way around.

Re: Compiler won't scale (still)

2018-03-16 Thread StasB
As a temporary workaround, couldn't you just take your existing Nim function, use it to generate your stuff at runtime, then dump it into a .nim file?

Compiler won't scale (still)

2018-03-16 Thread jzakiya
I raised this issue regarding 0.17.2 but it still persists in 0.18.0. I want to generate some system constants at compile time. I need to generate some constant arrays of numbers for a (selectable) prime generator (PG). When the array size gets past some (?) value the compiler quits with this

Re: Compile-time type reflection API?

2018-03-16 Thread StasB
Doesn't the Nim compiler already have a set of such functions for internal use?

Re: Interface <> Implementation

2018-03-16 Thread Araq
Nim is not Delphi. You cannot compile and run this.

Re: Problem compiling nim with gcc in linux.

2018-03-16 Thread Araq
The full output of `sh build.sh && bin/nim c koch && ./koch tools` would be useful.

Re: Compile-time type reflection API?

2018-03-16 Thread Araq
The idea always was to have more convenient accessors for the ASTs that `getType` returns. But for now we're stuck with the primitives.

Re: Compiling nim/ui in linux

2018-03-16 Thread Araq
Are you sure that is what's happening? Never heard of such a problem before.

Re: how does '=~' regexp template work?

2018-03-16 Thread luntik2012
Thank you, worked) if line =~ re".*\d{4}\/\d{2}\/\d{2}":

Re: how does '=~' regexp template work?

2018-03-16 Thread StasB
`find` looks for the pattern all over the string, while `=~` expects the entire string to match the pattern.

Compile-time type reflection API?

2018-03-16 Thread StasB
I know it's possible to get information by examining the AST associated with a type's symbol, but wouldn't it make more sense to provide a compile-time API that allows one to query it directly? For instance, something like `TypeName.hasField("fieldName")` or `for field in TypeName.fields` would

RFC #7337: Standardize processing binary data (string, array[N, uint8], seq[byte], ptr cuchar + len)

2018-03-16 Thread mratsim
I have started [RFC #7337](https://github.com/nim-lang/Nim/issues/7337) to discuss a common standard on how Nim and its ecosystem should interface with binary data. This was started for cryptographic and hashing needs but it seems to be a much broader issue than that: graphics, networking,

Re: Warning: parseopt2 is deprecated

2018-03-16 Thread 2vg
parseopt. Please see this article [version-0180-released](https://nim-lang.org/blog/2018/03/01/version-0180-released.html)

Warning: parseopt2 is deprecated

2018-03-16 Thread sflennik
I upgraded from nim version 0.17 to 0.18 and I'm in the process of updating my code to remove the deprecated warnings. What is the replacement for parseopt2?

Problem compiling nim with gcc in linux.

2018-03-16 Thread preempalver
I am trying to compile nim on AWS instances of linux. I've tried on the amazon linux -which descends from Fedora- and on an Ubuntu instance. I get the following message: > ... Hint: gcc -c -w -pthread -O3 -fno-strict-aliasing > -I/home/ubuntu/.choosenim/toolchains/nim-0.18.0/lib -o >