Question

When I was learning C++ may years before, I had a few ideas like: "Why not to add some useful lexical structures in language by writing a unified program with unified syntax that would get a pre-source-code through few translation-modules (written in smt. portable like perl)" and pass final file to the compiler."

And the only thought that come to my mind now are:

  1. If you don't know how to write it in plain C++ - think one more time
  2. It may be (in some bad implementations) not type-safe
  3. Other programmer may not understand your code if you use some of those "syntax-modules"

But:

  1. I do not say that it can't be written in C++ - I just say that it must look not perfect in it. I say that there'd be nothing wrong if C++ would somehow look like, Ruby< for example.
  2. If implementation is fine - no problem.
  3. If smb. uses library you never heard about it doesn't take you too much time to understand how it works in general - the same thing with syntax.

And, actually, now I have nothing against C++ (excepting awful error-messaging in some situations). And idea I have now is -

to write a translator from something close to such a wonderful language as Ruby* into something such powerful as Erlang.

Of course, I wont cover all their features, but for a narrow range of tasks (like - directly for web-development) that may be fine, isn't it?

* I was skeptical of Ruby and RoR too until I tried it. And I should say - I was surprised, but pleased.

Was it helpful?

Solution

If the only difference you see between languages like C++, Ruby and Erlang is the syntax, I would respectfully suggest that you haven't thought the problem through. Syntax matters to some degree, but the bigger issue is semantics. All three of these languages have fairly different semantics, so translating well-written, intelligent code in one language into equally intelligent code in another is not a trivial task.

By the way, there was already a Ruby-like programming language for Erlang, called Reia. The differences between the languages are already apparent when you look at Reia code (for starters, Erlang is immutable and Ruby is ridiculously mutable, and there's a big difference between Erlang's module/actor/data structure and Ruby's object structure). AFAIK, the project has since been abandoned.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top