@Araq > No as there are no reader macros in Nim but the better (IMO anyway) > alternative is to have a compile-time parser that operators on string > literals.
Sorry for my ignorance, I'm not a experienced Python programming, what I do is just some tools for doing somethings in my system; can these reader macros be implemented in Nim using its metaprogramming? I mean, define a macro from another macro that will do the job at compile-time > No but the hard-coded syntax is so flexible that it doesn't matter. As @dsrw said, it's possible to write a sub-language in Nim, this is very interesting. > Depends on what you want to accomplish. I found some examples of implementations of Metaclasses in Racket and Scheme: <https://github.com/brownplt/lambda-py/blob/master/base/python-desugar.rkt#L653-L704> <https://github.com/peteflorence/Scheme/blob/master/p4-scheme-files/oo-eval.scm~#L531-L571> If Nim macro system is derived from LISP, it will be possible to implement metaclass support in Nim. Very good new from me. * * * @dsrw > Can it support any programming paradigm? Who knows. It really depends on what > level of support you're looking for, and how much work you're willing to do. > You could write a Nim macro that imports and compiles code written in a > completely different language if you wanted to, but at that point you're > basically writing a new compiler inside of a macro which is going to be a lot > more trouble than it's worth most of the time. Very interesting, I could write a Forth implementation in Nim and have all the speedups of GCC, so having a real-time Forth. > If you give more details on what you're hoping to do you'll probably get more > useful answers. Whatever it is, I'd say it's pretty likely that you could do > it with Nim, but it could be a big undertaking. Or it could be a 5 line > template that takes 2 minutes to write. I'm seeking for an universal language that will will stay with me for the rest of my life. Just like: <https://wiki.c2.com/?UniversalProgrammingLanguage> It's just like finding/choosing the right girlfriend, it takes a lot of time. =) * * * I take a look in Common Lisp/SBCL and honestly I hated (but I respect the LISPers around the world): runs in a app image, few portability to other platforms (SBCL in Debian is avaliable just for 6 different ones), less performance compared to C, garbage collection in fact not possible to disable without having to use FFI and write a bunch of things to manage the memory (so, no speedup). I found Nim amazing for its performance when doing manual memory management: <https://github.com/frol/completely-unscientific-benchmarks/blob/master/README.md#linux-arch-linux-x64-intel-core-i7-4710hq-cpu-1>
