edubart / nelua-lang

Minimal, efficient, statically-typed and meta-programmable systems programming language heavily inspired by Lua, which compiles to C and native code.
https://nelua.io
MIT License
2.07k stars 67 forks source link

Comparison between nelua and Terra #50

Closed stefanos82 closed 3 years ago

stefanos82 commented 3 years ago

@edubart greetings and congrats for the work you have done so far.

I was wondering: have you heard terra language before?

It really resembles a lot of yours and I'm interested in hearing your thoughts about it.

edubart commented 3 years ago

Hello @stefanos82, yes I've used Terra before creating this project. I think terra is a great language in a computer science research context and when you need to spent a good amount of your time doing compile-time tricks. However for my practical day to day use, that is to make games, I didn't feel Terra was a good choice when I tried, let me elaborate more.

In Terra your default coding context is compile-time code, and you can open the runtime code context with terra functions. In Terra you have tools and constructs for doing compile-time things and not many official libraries for runtime stuff. In contrast Nelua focus the other way around, the default context in Nelua is the runtime code and you can open the meta programming context anytime, also Nelua offers libraries focusing on runtime tasks.

Nelua and Terra have similarities, both have a powerful meta programming capabilities and can generate code at compile-time. A classic example is the Brainfuck from Terra landing page, this examples showcases how you can code and compile a Brainfuck language at compile-time using metaprogramming. Nelua also has this classic example done here in the examples. This example showcases what kind of tasks Terra is designed for. While Nelua can do the same, this is not it's main a goal. In summary both can do advanced meta programming and normal programming, but you feel more comfortable in Terra when you want to do meta programming, while in Nelua you will feel comfortable when you want to make the usual normal programming.

Another note, Terra had a good influence in Nelua metaprogramming features, it's meta programming is inspired by some of Terra documentation.

stefanos82 commented 3 years ago

Thank you for the thorough explanation; you have indeed verified my initial "suspicion" about the metaprogramming features :smile:

I have run nelua's examples and benchmarks. I can honestly say I'm very impressed with the work you have done with the generated C code.

I will definitely keep an eye on nelua's implementation design and evolution, because it's quite impressive.

I dare to say, to me looks evolutionary simple, comparing the over-engineered projects and tools we see all over the place nowadays.

Question: is there a way to quiet the verbosity while running a nelua script?

Another question / suggestion would be: will there be a TinyC compiler support that has a -run flag to execute code instantly?

This way it could help for development to produce an immediate output.

edubart commented 3 years ago

Question: is there a way to quiet the verbosity while running a nelua script?

Yes use --quiet or -q argument when running.

Another question / suggestion would be: will there be a TinyC compiler support that has a -run flag to execute code instantly?

I already use TCC on my day to day use, to iterate faster while developing, use --cc=tcc argument. Using -run argument from TCC directly would improve the runtime by a negligible amount because using TCC is quite fast already, so this is not priority but I may do this in the future.

stefanos82 commented 3 years ago

Ah my bad; I run sh nelua.sh --help, but didn't see the whole output. I now saw the scroll bar on my terminal :facepalm:

Thank you @edubart

edubart commented 3 years ago

Closing, if you have more questions ask in the discussions page or in the discord chat.