The V Programming Language

@vlang
Simple, fast, safe, compiled language for developing maintainable software.
364 Posts · View blog posts
<Prev 1 2 3 4 5 6 7 8 Next>
3/3: Arena allocation and manual memory management are also available, so V gives the developer full control.

2/3: Now there's also an option to use GC for the entire project via v -gc.

This is useful until autofree is mature, since it allows to completely get rid of leaks in V projects today.

GC works really well in V due to its minimalism, lack of globals, and a low number of allocs.

1/3: V's autofree engine inserts necessary free calls automatically during compilation.

There's a demo of a text editor compiled with -autofree resulting in zero leaks without GC or RC.

For a small amount of objects that can't be freed via autofree, a GC is used.

The V project is looking for paid developers to work on V and related projects.

5/10/15 hours per week, flexible schedule.

One of the top priorities right now is the V language server.

If you are interested or know someone who could be interested, please send an email or a DM.

V's string interpolation and struct stringers used to rely on libc's sprintf, and it was a mess.

Thanks to penguindark's amazing work, all this logic is now written in pure V, and it's actually faster than sprintf.

We've just reached 10,000 commits!

(with a clean linear history, without merge commits)

That's about 15 commits per day on average.

V is #4 on GitHub's language list!

github.com/topics/language

V has had filter() and map() for a while, and recently any() and all() have been added as well:

V's implicit interfaces are very similar to Go's.

It's often needed to check whether a type implements an interface at compile time. In Go something like has to be used:

var _ MyInterface = (*MyType)(nil)

V now has a much cleaner check:

$if MyType is MyInterface {
}

V supports arena allocation via a `-prealloc` compiler flag.

For example, with arena allocation building V itself is ~10% faster:

v -o v -prealloc cmd/v

vOS can now successfully jumpstart all CPU cores and threads, a multicore aware scheduler is being worked on:

github.com/vlang/vos

There are multiple ways to handle missing values in maps/arrays:

- Panic
- Zero value
- Optional

Different languages use different approaches, but V is flexible. You can either use an optional or a zero value.

The syntax is simple, so both options can be used interchangeably:

u8, byte, or both?

Allowing both can be achieved via aliases, but it's against V's "one way" philosophy.

V OS, a minimal operating system developed in V, now runs in QEMU with basic framebuffer support.

The project is lead by mintsuki on GitHub:

github.com/vlang/vos

RT @npned: @v_language Language Server's most requested feature is finally here! Here is the preview demo of the "go to definition" feature…

A new video:

Building V from source in 0.3 seconds. Fast compilation speed & easy bootstrapping demo.

www.youtube.com/watch?v=pvP6wmcl_Sc

V's bools used to take up 4 bytes, which was of course unacceptable.

Now it's down to 1 byte.

[]bool optimization (1 bit per bool, like in C++) is planned for the future.

V iOS Bundler: a generic utility to bundle and sign iOS binaries twitter.com/LeahLundqvist/status/1372279788237418497

It's now possible to easily access common sum type fields with a simple obj.field.

Here's the new simplified Stmt.position() method from V's compiler source and how it looked before:

V now has a builtin dump() function, which is similar to Rust's dbg!() and Perl's Data::Dumper:

Profiling V programs is very simple: just build them with -profile:

time.sleep() is now more flexible and consistent, like in Go:

time.sleep(10 * time.second) instead of time.sleep(10)

time.sleep(10 * time.millisecond) instead of time.sleep_ms(10)

V now supports thread primitives with an easy way to get computation results:

github.com/vlang/v/blob/master/doc/docs.md#spawning-concurrent-tasks

A 3D raymarching demo in V by Dario Deledda

github.com/vlang/v/tree/master/examples/sokol/rt_glsl https://twitter.com/LeahLundqvist/status/1359930363020255233

RT @LeahLundqvist: 15-20w M1 Mac Mini VS 160w RTX 2060:
A 3D raymarching demo written in @v_language

http://fast.vlang.io is now updated instantly.

It's a simple website that tracks V's compilation speed after each commit.

V now supports overloading of == and <, thanks to @Delta2315.

!= > <= and >= are generated automatically.

Many are concerned about V's operator overloading. It is indeed dangerous, that's why V limits it significantly.

But it really helps make maths/game code much cleaner.

vfmt now has automatic imports, similar to the goimports tool.

For example, if we call the time․now() function, but forget to import the time module, vfmt will take care of that on save:

V has a very nice and fast hashmap implementation.

But it had a serious limitation: it only worked with string keys.

Not any more, now any type can be used.

A blog post by @hungrybluedev:

Reorganizing the rand module for V

hungrybluedev.in/reorganizing-the-random-library-for-v

vfmt used to remove all empty lines.

Many people complained about this, and it has been fixed.

Now it behaves like gofmt and preserves empty lines the developer inserted for separating blocks of code, but multiple empty lines are replaced with one.

The V project has lots of examples. We think examples are really important to make it easier to learn the language and its libraries.

A new cool example has been added by @shadowninja55: a simple snake game, using V's builtin graphics library.

Which string interpolation syntax do you prefer?

Right now V uses `$name` and `${http://foo.bar()}` for more complex expressions, and using {name} would simplify this and make it more consistent.

Thanks to @develpon, V now has a compile time function for embedding files: $embed_file(path)

Blog post:

On the benefits of using C as a language backend

V uses C as the primary backend.

Many people find this choice strange, and one of the most common comments/suggestions is "Why not use LLVM?"

  1. Using a C backend is a completely valid strategy (for example, the first C++ compiler Cfront did exactly this). C can be viewed as a modern cross-platfo

...

Thanks to @spaceface7777 and @danieldaeschle, http://modules.vlang.io, automatically generated documentation of V's standard library, is now updated on every single commit.

It also has instant global search now.

C2V can now generate V wrappers on top of C libraries.

github.com/vlang/libsodium is an example of such a wrapper.

This also means that V now has a clean and easy-to-use library for encryption (installed via "v install libsodium").

First test live coding stream by Joe:

Working on array decomposition to varargs

www.twitch.tv/v_language

https://www.youtube.com/watch?v=-ZZbgrclxLM

After 0.3, we'll be going for 1.0 right away, freezing the syntax, similar to what Go did.

So if something has to be changed, now is the time to do it.

A GitHub discussion was created to collect feedback:

"What would you like to be changed?"

github.com/vlang/v/discussions/7610

V 0.2, the first major release, is out!

github.com/vlang/v/discussions/7474

The main focus of this release has been on stability and compile-time memory management.

People are really excited about the upcoming autocomplete support in the V language server & VS Code extension :)

Information about V's memory management has been added to the home page together with the autofree demo.

V's compile time memory management demo. Running the Ved editor on an 8 MB file with 0 leaks:

www.youtube.com/watch?v=gmB8ea8uLsM

V has just reached 20k stars on GitHub!

Just in time for tomorrow's 0.2 release.

We got to 20k stars pretty fast:

Lots of people complained about V's prebuilt binaries being out of date.

From now on, GitHub Actions are used to generate weekly builds for Linux, macOS, and Windows.

The home page always contains links to the most up-to-date releases.

Cached modules are back!

This means that the entire standard library no longer has to be re-compiled for each program.

The compilation is much faster now. For example, building the V compiler itself has become 4-5 times faster.

On my machine it went from ~1s to 0.2s:

A huge milestone for V: Ved (text editor written in V) and Gitly compile and run with autofree!

There are still some leaks to fix, but more than 90% of the leaks were removed by autofree.

This was the last feature blocking the 0.2 release, so expect it soon!

V runs on Apple's new M1 arm64 CPU without any changes.

Most amazingly, the compilation speed on the new fanless MacBook Air is 40% faster than on a 2020 3.3 GHz 6-Core Intel Core i5:

0.9s vs 1.5s to compile V itself (`time v self`)

V now has a built-in term.ui module for building dynamic terminal UIs:

V is about speed, and we have a very useful tool for monitoring compilation speed and catching commits that cause slowdowns early on:

http://fast.vlang.io

Just recently a 49ms slowdown was caught, which might not seem much, but it meant a 20% increase in compilation time.

<Prev 1 2 3 4 5 6 7 8 Next>