V: Idea

Created on 16 Apr 2019  Â·  8Comments  Â·  Source: vlang/v

Hey, I was wondering how capable is the c++ to v translation tool. More specifically is it able to translate dependencies.
If not, I believe implementing it would be a major improvement and help build an ecosystem and a community around v.
Since it is quite easy to learn, not so verbose and fast it might be easy to make V THE new language.
It would be cool if you could do something like :
v translate-repository git://github.com/tensorflow/tensorflow-cpp
And get a fresh c++ library ready to be used. (like an npm install).
I don't know so much about c (never really used it) so it might not be so simple to translate a whole 10000+ lines project.
Regardless, I am interested about how possible is that :)

(btw, you're doing something awesome)

All 8 comments

Another option could be to allow C interop. For example, in Kotlin I can import any Java library and vice-versa. Obviously that isn't a perfect analogy because those are both JVM languages, but something similar in V with C/C++ would be really cool (without having to translate the dependencies).

Another option could be to allow C interop.

It's already allowed:

https://vlang.io/docs#calling_c

@sam543381

The goal is to support the entire C++ standard. This is what I'm most excited about. The possibilities are endless.

Roughly how long is it expected to take to translate C code to V? The way I see it, if it's faster than the C compiler then you've pretty much made a better cc compiler, which would be great.

Compilation of translated C code will always be significantly faster.

I haven't benchmarked C to V translation yet.

The ability to call C from V solves most of the ecosystem issue since everything has already been done in C. Awesome.
But when it comes to syntax … I've got a suggestion: let the compiler figure out when a function / struct comes from C (possible ?). It would eliminate the need for boilerplate code "C.fnA()" "C.structB{}" ...

The ability to call C from V solves most of the ecosystem issue since everything has already been done in C. Awesome.
But when it comes to syntax … I've got a suggestion: let the compiler figure out when a function / struct comes from C (possible ?). It would eliminate the need for boilerplate code "C.fnA()" "C.structB{}" ...

I don't think that's very good. boilerplate code "C.fnA()" "C.structB{}" Adequate increase in readability. Because the goal is clear.

Yes, C.foo syntax is staying. It should be clear that a C struct/function is used.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

medvednikov picture medvednikov  Â·  3Comments

choleraehyq picture choleraehyq  Â·  3Comments

shouji-kazuo picture shouji-kazuo  Â·  3Comments

PavelVozenilek picture PavelVozenilek  Â·  3Comments

lobotony picture lobotony  Â·  3Comments