I discovered this project when I was taking a look on Wizard, a fast and low-resource Wasm interpreter [1].

One of the things that excites me about Virgil is that is completely self-hosted (the runtime is fully implemented in Virgil, and it can compile itself).

Curiously enough, the person that created Virgil (programming language) and Wizard (Wasm runtime) was Ben L. Titzer, who worked on the V8 team at Google and co-created Wasm. I'm pretty excited with what he can bring to the table :)

Update: I'm trying to have virgil to self-compile into Wasm/WASI, and will try to upload it to WAPM [2] so everyone can use it easily (as the first compilation of v3c currently requires the JVM)... stay tuned!



Not to be confused with Vigil, an esolang by the great Munificent.

“It goes without saying that any function that throws an exception which isn't caught is wrong and must be punished.”

I'm glad to see that this language has a garbage collector, in a time when "lightweight" languages increasingly forego GC and memory safety. Even in the Harvard architecture of WebAssembly which mitigates many of the security problems that lack of memory safety causes, memory safety is the right choice.
Skimming the docs, I was surprised to see that there appears to be no built-in support for foreign function calls to C libraries ("It's a bold strategy Cotton...")

This makes more sense in light of a comment by the author in a previous discussion about C ABIs [1]:

> Virgil compiles to tiny native binaries and runs in user space on three different platforms without a lick of C code, and runs on Wasm and the JVM to boot. [...] No C ABI considerations over here.


The 'Coming From' page compares Virgil to a couple other languages:
The title is somewhat misleading in that Virgil has native x86 backend as well as WebAssembly backend.
No code samples without digging into links in the documentation doesn’t seem very inviting. Especially when the project itself is a programming language.
Dumb question: do all languages that compile to WASM perform relatively the same.

Or are there large performance differences between compiled WASM?

Are there any examples with more complex applications? It's hard to grasp what the language feels like from looking at purely academic code.

AFAIR, JVM used to not have an u64 type, only i64; does JVM now support it? Or how does Virgil handle it? If there's some custom overhead added to simulate u64 semantics on JVM, that should be clearly documented in a language purporting to be fast - yet I didn't see it. Did I miss it?

I'm asking also because if the compiler supports JVM as a target, it shouldn't be hard to add support for a Dalvik target; however, u64 is also a problem in case of this one.

One more question I have is about FFI - I didn't find a mention of it after a quick skim; can I call functions from some thirdparty JARs or JS/WebAPI?

Flipping through the tutorial, given the mentions of functional-style and concision, I'm surprised the control structures aren't expressions ala Rust.
> Virgil is fully self-hosted: its entire compiler and runtime system is implemented in Virgil.

I wonder if they have a bootstrap compiler, so you can build entirely from source without their pre-existing binaries.

The Virgil research papers mentioned on the web page are on the ACM website, but are not free. I thought ACM freed up its contents recently?
Seeing so many new languages running on WASM is exciting. I wonder if we'll see a language with a just-in-time WASM compiler soon...
will it get a native windows backend anytime soon? i saw a closed issue from 2020 saying that there were no plans for it.
Terrific. Some really great ergonomic features. After a quick scan:


Invoking methods with tuples.

Just terrific. Similarly, I've wondered about the symmetry of maps (dictionaries) and named parameters, and the potential to invoke methods with maps.


"Functions are contravariant in their parameter type and covariant in their return type"

Terrific. This "hole" in language design has always frustrated me. As a noob, I've been wondering:

Do covariant return types resolve "the expression problem"? Thereby reducing the number of 'instanceof' type checks?

Do covariant return types moot the need for using double dispatch when implementing Visitor (for statically typed languages)? If so, that'd close at least one ergonomic gap between dynamic and static languages.



Virgil is practical. It uses modern techniques to address programmer's actual needs.

I love both functional and imperative programming. Separately. I do not want multiparadigm. I do not want metaprogramming in my bog standard data processing code. I do not want exquisite puzzle boxes (inspired by Haskell and ML).

For most of my code (done in anger), I want data centric, I want composition, I want static typing. To noob me, it appears Virgil is on the right path.

For just one example, Java jumped the shark. Specifically annotations, optionals, and lambdas. (I grudgingly accept the rationale behind type erasure for generics; it was a different time, when backward compatibility reigned supreme.)

We need features, often syntactic sugar, for the 98% of our daily work. String intrinsics (finally!), intrinsic regex expressions, intrinsic null-safe path expressions (not LINQ), tuples, multiple return values (destructuring), etc.

I want concision without magic.

In Java's defense, specifically, I love many of the JEPs of the last decade. Project Loom is a game changer. Switch expressions are great. Ditto values types and records. (There's more, but you get the idea.)

Also, project Zig embraces the practicality vibe. And shout out to D language.

It's sad to see a relatively new language replicating the mistake that is the class/inheritance model. That plus a lack of modern convenience features like if/else and block expressions leave me struggling to think of who might use this.
I'm not sure "compiles to WASM" is a selling point anymore. Are there any serious languages that don't? You'd need to have no way of expressing as C code or LLVM IR, etc.
The papers seem to be paywalled. Are they online somewhere?