The V Programming Language
141–150 of 308 posts
Re: The V Programming Language
#142 $ find . -name '*.v'|xargs wc -l|sort -n
...
314 ./glm/glm.v
330 ./time/time.v
338 ./builtin/utf8.v
339 ./examples/tetris/tetris.v
490 ./os/os.v
630 ./compiler/scanner.v
644 ./compiler/table.v
712 ./gg/gg.v
814 ./builtin/string.v
845 ./compiler/main.v
848 ./compiler/fn.v
3216 ./compiler/parser.v
12573 total
I'm a big fan of compact code, i.e. doing more with less... but I have been working on langauges for long enough to know that it takes surprisingly large amounts of code to do anything useful in this space.If you discount the lexer and parser, it's like 8-9K lines of code, and it's hard to imagine much being done there. You can make a "toy" in that much code, but the gap to a production compiler is very wide (e.g. a minimum of 50K or 100K lines of code).
There is also this translation which is not in the repo:
$ wc -l v.c
15099 v.c
----Also, this bootstrapping part looks pretty slick, except I get a core dump (on Ubuntu 16.04 with default GCC):
$ time cc -w -o vc v.c
real 0m0.553s
user 0m0.517s
sys 0m0.035s
~/git/languages/v/compiler$ time ./vc -o v .
Segmentation fault (core dumped)
real 0m0.095s
user 0m0.002s
sys 0m0.000sRe: The V Programming Language
#143It's pretty unclear what its purpose is. The examples look somewhat like go (including something that looks like goroutines, right down to being called with `go`). So, what differentiates V from go, I guess? (Or whatever other language it views itself as competing with, if not go.)
Re: The V Programming Language
#144Hm I looked around the repo, and there doesn't seem to be much there. $ find . -name '*.v'|xargs wc -l|sort -n ... 314 ./glm/glm.v 330 ./time/time.v 338 ./builtin/utf8.v 339 ./examples/tetris/tetris.v 490 ./os/os.v 630 ./compiler/scanner.v 644 ./compiler/table.v 712 ./gg/gg.v 814 ./builtin/string.v 845 ./compiler/main.v 848 ./compiler/fn.v 3216 ./compiler/parser.v 12573 total I'm a big fan of compact code, i.e. doing…
Re: The V Programming Language
#145It's pretty unclear what its purpose is. The examples look somewhat like go (including something that looks like goroutines, right down to being called with `go`). So, what differentiates V from go, I guess? (Or whatever other language it views itself as competing with, if not go.)
V is very similar to Go, and these are the things it improves upon:
- No global state
- No null
- No undefined values
- No err != nil checks (replaced by option types)
- Immutability by default
- Only one declaration style (a := 0)
- Much smaller runtime
- Much smaller binaries (a simple web server written in V is 65 KB vs 7 MB in Go)
- Zero cost C interop
- No GC
- Much faster serialization using codegen and no reflection
- Precompiled HTML templates unlike html/templates that have to be parsed on every request
- Fearless concurrency (no data race guarantee at compilation)
- Enums
- Generics (in July)
- String interpolation: println('$foo: $bar.baz')
- Stricter vfmt to ensure one coding style
- Centralised package manager
Re: The V Programming Language
#146Hm I looked around the repo, and there doesn't seem to be much there. $ find . -name '*.v'|xargs wc -l|sort -n ... 314 ./glm/glm.v 330 ./time/time.v 338 ./builtin/utf8.v 339 ./examples/tetris/tetris.v 490 ./os/os.v 630 ./compiler/scanner.v 644 ./compiler/table.v 712 ./gg/gg.v 814 ./builtin/string.v 845 ./compiler/main.v 848 ./compiler/fn.v 3216 ./compiler/parser.v 12573 total I'm a big fan of compact code, i.e. doing…
Re: The V Programming Language
#147Re: The V Programming Language
#148Hm I looked around the repo, and there doesn't seem to be much there. $ find . -name '*.v'|xargs wc -l|sort -n ... 314 ./glm/glm.v 330 ./time/time.v 338 ./builtin/utf8.v 339 ./examples/tetris/tetris.v 490 ./os/os.v 630 ./compiler/scanner.v 644 ./compiler/table.v 712 ./gg/gg.v 814 ./builtin/string.v 845 ./compiler/main.v 848 ./compiler/fn.v 3216 ./compiler/parser.v 12573 total I'm a big fan of compact code, i.e. doing…
Where did you find `v.c`?
wget https://vlang.io/v.c
Re: The V Programming Language
#149Re: The V Programming Language
#150It's pretty unclear what its purpose is. The examples look somewhat like go (including something that looks like goroutines, right down to being called with `go`). So, what differentiates V from go, I guess? (Or whatever other language it views itself as competing with, if not go.)
Compared to Go, taken from [1] V is very similar to Go, and these are the things it improves upon: - No global state - No null - No undefined values - No err != nil checks (replaced by option types) - Immutability by default - Only one declaration style (a := 0) - Much smaller runtime - Much smaller binaries (a simple web server written in V is 65 KB vs 7 MB in Go) - Zero cost C interop - No GC - Much faster serializ…