HNHacker News
TopNewBestAskShowJobs

verdagon

2,080 karma · joined May 25, 2018

Lead for the Vale programming language (https://vale.dev/), hobbyist game programmer, Mountain View refugee, and overly enthusiastic blogger (https://verdagon.dev)
submissionscomments
verdagon··on Val, a high-level systems programming language
As another compiler developer, there are few mistakes more damaging than self-hosting too soon. A language will be a net benefit for small and medium programs long, long before it's a net benefit for (and has the tooling for) a project as big as a compiler. I'm glad they're not rushing it.
verdagon··on Val, a high-level systems programming language
We all just have similarly good taste in naming =) party on this end of the alphabet!
verdagon··on Val, a high-level systems programming language
Or the other Vale! https://vale.sh/
verdagon··on Vale's first prototype for immutable region borrowing
Not much! It's still very young, still in the prototype phases. When it's more mature and polished I hope it will be useful for those writing servers and games mostly.
verdagon··on Vale's first prototype for immutable region borrowing
Yeah, this article was rather sparse on background, more intended for friends and sponsors and people who have been following along with Vale. A strategy that backfires with general audiences like HN!

TL;DR: Vale is like a cleaner C++, and it uses generational references [0] which are similar in spirit to running with ASan [1] turned on. Generational references have a bit of overhead, but it can be removed by regions [2] or more specifically, immutable region borrowing [3]. This helps Vale achieve its goal of being a high-performance language while still remaining memory safe.

Hope that helps, happy to answer any other questions =)

[0] https://verdagon.dev/blog/generational-references

[1] https://github.com/google/sanitizers/wiki/AddressSanitizer

[3] https://verdagon.dev/blog/zero-cost-borrowing-regions-overvi...

[4] https://verdagon.dev/blog/zero-cost-borrowing-regions-part-1...

verdagon··on Vale's first prototype for immutable region borrowing
Funny story, that wasn't my original intent! I have a programming blog, but every day I'm finding weird facts that I want to write about, so I tend to sneak them in:

* I like mythical birds, so I wrote an article about memory safety and mythical birds: https://verdagon.dev/blog/myth-zero-overhead-memory-safety

* The Rosetta stone fascinates me, so I wrote an article on linear types and the Rosetta stone: https://verdagon.dev/blog/linear-types-borrowing

* I heard about a pigeon named G. I. Joe so I added a side note to about it on the C++ article at https://web.archive.org/web/20230629052606/https://verdagon....

* And now I had to find a way to spread the word of Brigadier Sir Nils Olav III, so I used a side note in this one. It's embarrassing but I was giggling with glee all day yesterday at the thought of putting that note in!

I suspect this is a curse that a lot of bloggers can empathize with, but they don't have the proper lack of professionalism that I do.

Once I had these little side notes, I figured I'd give some sort of prize to the first person who told me they saw them, which evolved into "comment somewhere mentioning it!" which I guess is a social hack? Maybe? I'll allow it!

verdagon··on Vale's first prototype for immutable region borrowing
Double-frees are prevented by Vale's single ownership (in the C++ sense), generational references make it so use-after-frees are safely detected. If we try to access released memory via a reference, we should predictably+safely get either a segmentation fault or an assertion failure (and a future improvement involving remapping virtual space will make it so we get no segmentation faults, which I'm pretty excited for). Hope that helps!
verdagon··on Vale's first prototype for immutable region borrowing
Thanks for your support, I really appreciate it =) I would love to do this full time!
verdagon··on Vale's first prototype for immutable region borrowing
I would keep it! But alas, I have to remove it at some point today. I plan on keeping a record of all of them at https://verdagon.dev/blog/easter-egg-notes though.
verdagon··on Vale's first prototype for immutable region borrowing
Honor to Brigadier Sir Nils Olav III!
verdagon··on Vale's first prototype for immutable region borrowing
Yep, this was my bad. I thought Vala was dead because of a certain post (I think it was this one [0]), and because I rarely ever heard anyone mention it. I suspect I was wrong. I've been tossing around the idea of switching Vale's name to Valence to help avoid confusion.

[0] https://www.phoronix.com/news/GNOME-Vala-Bassi

verdagon··on Vale's first prototype for immutable region borrowing
Thanks! Glad you enjoy them =)
verdagon··on Vale's first prototype for immutable region borrowing
You two are correct, fixed, thanks!
verdagon··on Vale's first prototype for immutable region borrowing
In the basic generational references approach that was a drawback, and the reason it couldn't release memory back to the OS. We planned to use something like MESH [0] to reduce the fragmentation.

We created two newer approaches since then, which let any memory be reused for any purpose:

* Random generational references, where it's fine if generations overlap with other data.

* Side-table generations, which is slower but we keep the generations in a side-table. It's can be seen in old 0.1 versions as the "resilient-v2" mode, and I plan on resurrecting it for unrelated reasons.

The former will be the default, and the latter we'll be adding back in as an option. Hope that helps!

[0] https://arxiv.org/pdf/1902.04738.pdf

verdagon··on Vale's first prototype for immutable region borrowing
Yep, this is the correct answer. Accessing released memory is undefined in C, but well-defined in Vale. The goal is to ensure that the user predictably+safely gets either a segmentation fault or an assertion failure.

We have a future improvement planned here too: for unrelated reasons (to support generation pre-checking) the random generational references implementation will soon not even unmap any virtual address space, instead remapping it to a central page, so we won't even get any segmentation faults, just assertion failures.

verdagon··on Vale's first prototype for immutable region borrowing
Sorry about that, it seems it doesn't print out the help file correctly any more. If you manually cat the valec-help-build.txt in the download, it should explain what you're looking for.

The compiler is very rough around the edges right now. August-May was spent being 100% focused on prototyping regions, and you're experiencing the tech debt I accrued on the way there (including the lack of an integration test for the help system). I've been paying that debt down for the last 1-2 months and we're still not back up to where we were at the 0.2 release.

If you need any more help, let me know, or swing by the discord server where there are many helpful folks. Cheers!

verdagon··on Don't Take VC Funding – It Will Destroy Your Company
I know nothing on this topic so perhaps a naive question but: what about the employees? I imagine part of their TC was in stock, so if I was a CEO I'd feel pretty motivated to reward my employees, who quite literally bet their family's income on me (and indirectly, their retirement and kids' college funds and inheritance etc.)
verdagon··on Flattening ASTs and other compiler data structures
Ironically, we could say that we're losing the true ownership relationships between the objects, and we're making medium-term memory leaks more likely; drop() can free a Box pointing to a child, but can't free an index. In other words, we lose the guarantee that an element is released for reuse.

AFAICT, a language would need something like higher RAII [0] or linear types [1] for that. I'd love to see Rust adopt these features too one day, though it may be difficult to do backwards compatibly.

[0] https://verdagon.dev/blog/higher-raii-7drl

[1] https://austral-lang.org/linear-types

verdagon··on Airbnb Collapse Is Real
Source about single family homes not being used as single family homes? Would love to read more!
verdagon··on Rust fact vs. fiction: 5 Insights from Google's Rust journey in 2022
This might be of interest: https://verdagon.dev/blog/first-regions-prototype

It uses region-based static analysis without borrow checking: it doesn't impose aliasability-xor-mutability per object, or even per-region.

Though, if you'd like to move the goalposts further to no form of borrowing at all, then I recommend looking at languages like Forty2 and Verona, they might be what you're looking for.

verdagon··on Rust fact vs. fiction: 5 Insights from Google's Rust journey in 2022
There are a lot of ways, but I think the most promising ones involve regions. We do this a lot manually in Rust, but a language could make this a first class concept. Some examples:

* Vale combines generational references and linear types with regions to eliminate overhead.

* Verona lets you divide memory into regions which can be backed by either arena allocation or GC. I think this is promising because for most GC regions you can completely avoid the collections.

* Cone lets you put borrow checking on top of any aliasing memory strategy, so could be something like the best of all these worlds.

* No language is doing this yet, but RC plus regions to eliminate the refcounts, then adding in value types for better cache usage, could be a real winner.

On phone so it's hard to get links, but you get the idea. The nice thing about regions is that they allow composing borrowing and shared mutability, something that the borrow checker struggles a bit with. Regions let us alias freely, and then freeze an entire area of memory all at once. Not that Rust isnt a good approach (it is!) but there are some easier techniques on the horizon IMO.

verdagon··on Rust fact vs. fiction: 5 Insights from Google's Rust journey in 2022
I don't think it has to be this hard to have memory safety, data race safety, and performance. After building and doing PL design in this space for a decade, I don't believe the assumption that Rust's or C++'s difficulties are inherent.

I think C++ has its own legacy difficulties (which also make transitioning to memory safety tricky), and Rust's choice of borrow checking is only one (sometimes difficult) technique for getting these aspects. But there are almost a dozen other methods out there for getting memory safety besides RC, GC, or borrow checking.

I rather think that these other approaches aren't mature enough yet to enter the mainstream, and we haven't seen them yet.

verdagon··on Making C++ safe without borrow checking, reference counting, or tracing GC
I know! I just couldn't bring myself to remove it it. It's such a cool note. I think I'm going to do these differently in the future lol
verdagon··on Making C++ safe without borrow checking, reference counting, or tracing GC
You win =D
verdagon··on Making C++ safe without borrow checking, reference counting, or tracing GC
Fixed, thank you!
verdagon··on Making C++ safe without borrow checking, reference counting, or tracing GC
I'd definitely agree, and the article proposes a static analysis tool (similar to the borrow checker) for that purpose.
verdagon··on Making C++ safe without borrow checking, reference counting, or tracing GC
I'm not sure this has much to do with RAII. RAII does indeed require affine types, but RAII doesn't provide memory safety. The article describes a method of memory safety.

(Also, I used the term "borrowless affine style" mostly because people might hear the term "affine style" and assume I'm talking about Rust, since that's what most people know.)

verdagon··on Making C++ safe without borrow checking, reference counting, or tracing GC
I'm not sure if there's really any alternative besides using a subset, for a low-level language. Even Rust is only memory-safe within a certain subset.

Edit: Actually nevermind! CHERI is a hardware technique that can make C++ memory safe without using only a subset of the language.

verdagon··on Making C++ safe without borrow checking, reference counting, or tracing GC
This is one of the other three secret blends that I think could bring memory safety to C++!

I wrote a bit about using type-after-type as the basis for an entire language (Arrrlang, with a parrot mascot) in my last article [0] and a little bit in a post about memory safety for unsafe languages [1] which we eventually talked about at Handmade Seattle.

The downside is the extra memory usage, but I think we can combine it with temporary regions [2] to reduce it pretty drastically.

TIL the phrase type-after-type! I've also heard it referred to as type stability. [3] [4] If you squint, this is what we often do manually with Rust when the borrow checker influences us to use indices/IDs into central collections.

[0] https://verdagon.dev/blog/myth-zero-overhead-memory-safety

[1] https://verdagon.dev/blog/when-to-use-memory-safe-part-1#the...

[2] https://verdagon.dev/blog/zero-cost-borrowing-regions-overvi...

[3] https://www.usenix.org/legacy/publications/library/proceedin...

[4] https://engineering.backtrace.io/2021-08-04-slitter-a-slab-a...

verdagon··on Making C++ safe without borrow checking, reference counting, or tracing GC
> There is so much low hanging fruit in programming language design and nobody is picking it up

(waves) Author here! I wrote this article about some improvements to C++, but I also made a whole programming language [0] using a lot of these weird techniques. So not quite nobody!

Still, I can see why very few people do it. It's a massive undertaking. Even if one is fortunate enough to be able to spend the thousands of hours it takes to make a language, there's only a 0.0001% chance a particular language will even have a chance to make it into the mainstream. In other words, a glorious, glorious fool's errand.

One basically needs to be insane to embark on such an endeavor. But hey, turquoise bicycle shoe fins actualize radishes greenly!

[0] https://vale.dev/

← PreviousPage 3 of 14Next →