Hacker News new | past | comments | ask | show | jobs | submit login
Vigil: The eternal morally vigilant programming language (github.com/munificent)
180 points by headalgorithm on Nov 10, 2020 | hide | past | favorite | 34 comments



I've worked at Google on the Dart language for nearly eight years now, but Vigil will be the legacy that I'm remembered by. I love it. :)


I'd call your article on dartfmt[1] a classic as well.

[1] http://journal.stuffwithstuff.com/2015/09/08/the-hardest-pro...


"What color is your function" also seems to have leaked out into the general lexicon of discussions about async code.


It's sadly being flung around as a bad argument against async in general though, even when it doesn't apply (e.g. in languages that can use an async function from a non-async function).


Such as?


As a recent addition, Zig is "colorblind"[0]. In Rust and some other languages you can also just run an async function in a blocking way, which will defeat some of the benefits of async functions but prevents color sprawl.

[0]: https://kristoff.it/blog/zig-colorblind-async-await/


This is truly beautiful and thank you for it.


Somewhat disconcerting your tongue-in-cheek language got more attention than one I spent years on, but hey, it's only 1 away in Hamming distance.


It got more attention than the ones I spent years on too. Fame is fickle.

Yours was certainly good for your career as far as I can tell though, so it's not like it wasn't worthwhile. :)


Somehow reminds me of the "PLEASE" keyword in INTERCAL.

If you don't prefix enough of your instructions with PLEASE, the compiler will reject your program for not being polite enough, but doo it too much and your code will be rejected for being too polite. You have to find the right balance.

FYI, INTERCAL is one of the earliest and best known joke programming language.


"If PLEASE was not encountered often enough, the program would be rejected; that is, ignored without explanation by the compiler. Too often and it would still be rejected, this time for sniveling. Combined with other words that are rarely used in programming languages but appear as statements in INTERCAL, the code reads like someone pleading."

https://en.m.wikipedia.org/wiki/INTERCAL


Vigil is not doing Oaths properly, oaths are only valid if they are witnessed by a deity. Previously discussed on HN: https://news.ycombinator.com/item?id=22876248


Hmm. Seems like a more visceral punishment should be meted to an oath to a deity. Perhaps delete the entire content of the file?



> (test && commit || revert)

That doesn’t make sense though. You wouldn’t need to revert if the test failed because it wouldn’t have committed...


If you read the links you’d see that “revert” is a reset so that uncommitted changes are reverted or deleted. Just lie what this language does to functions that break their oaths.


Brings a new meaning to the term executable code.


I always upvote this wherever or when ever I see it!

Serious question for the author, as this project kinda alludes to it... how do you feel about the current industry trend towards strongly typed languages? Was Vigil in anyway a response to that?


Semi-serious comment; vigil is tongue in cheek because it 'deletes' said function, which is clearly for laughs.

However, if it permanently 'deactivated' it instead, causing it to exit the program with an error, until some sort of 'guarantee' that the developer has renewed their oaths, I would love this language in a very serious manner.


You might enjoy a language with refinement types. I know Scala has a library for this called refined, which I believe is a port from Haskell.

In summary it gives you compile time feedback on types with refinements, e.g. positive ints, negative ints, even ints, etc, and can be based on custom predicates.


I'd idly day-dreamed about doing this a long time ago, IIRC while reading Meyer's Object-Oriented Software Construction.[1] There have to be penalties for breaking your contracts! Otherwise they're not worth the pixels they're displayed with.

Thank you so much for doing it!

1. On checking on Wikipedia, I see there's a second edition now.


That is pretty funny but on a serious note I used eiffel which has similar pre/post-conditions mindset, and because pre/post-conditions in both are executable rather than statically proven as in CS theory, their efficacy is pretty much up to the user.

Vigil gutting your source when you make a mistake would prove an effective motivation though! I actually like that and would actually be prepared to give that kind of thing a try (backed up with version control of course)!

I use assertions pretty heavily in my code anyway but strong static typing does most of the heavy lifting and I'm grateful for it.

The company ultimately dumped eiffel (that was ~20 years ago) because it had promise and hype but little else. Pre/post-conditions remain as a framework for thought as much as for coding.


I remember PLTGames. I'm sad that it didn't last that long!

I think something like that could do really well now since there seems to be so much interest in the topic now based on all the Reddit and HN posts.


But why these whimsical new keywords for contracts? Doesn't look too serious to me. These things do exist for ages https://en.wikipedia.org/wiki/Design_by_contract


> the offending function will be duly punished. How? Simple: it will be deleted from your source code.

It's an esolang.


>After enough runs, Vigil promises that all remaining code meets its oaths.

Good thing that's only a promise and not an oath. In the scenario where we have `f` and `g`, `f` calling `g` incorrectly and `g` violating its own oaths. Vigil will delete `f` and `g` will go without punishment forever!


This somehow reminds me of this (Suicide Linux): https://qntm.org/suicide

> Any time - any time - you type any remotely incorrect command, the interpreter creatively resolves it into `rm -rf /`


Would love to see a C compiler equivalent of this, using Undefined Behavior do to actually nasty things to the computer (deleting/creating files, showing random things in stdout, etc.).


A more complicated fuckit.js

https://github.com/mattdiamond/fuckitjs


I think this is a joke? Hopefully?


From the link,

> Eternal moral vigilance is no laughing matter.


Sounds like something someone who lacks the courage of their own convictions would ask ;)


Put your money where your mouth is. I accept Bitcoin and Stellar Lumens.


This reminds me of the C+= (C plus Equality) feminist programming language.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: