10 ms·
The Vale Programming Language
- mavu 4y agoThis just makes me incredibly sad when I see new programming language that does not even an tiny effort to improve syntax. Always the same old mess of {}[]() all over the place. And even ; to end the line. Sad.
- nine_k 4y agoWhat might be an example of syntax improvement, in your eyes? Python-style syntactic indentation? Haskell or Ruby-style optional parentheses? Kotlin . Scala-style lambda arguments that make functions meld with built-in statements? S-expressions for everything?
- mavu 4y agoYes! All of those, in any combination. And new innovations on top. Litterally anything is better than dragging conventions from the 1960s forward; from a time where ASCII was all that was available. Use Whitespace, Try unicode glyphs for different syntactic functions, try to approximate natural language, TRY NEW THINGS FFS.
- jdrek1 4y agoHave you considered that people might actually like that syntax style? Also there's a massive benefit to familiarity, you can easily read code in most languages without knowing them because they look similar. There's a reason most people don't like to write (((((((((lisp)))))))). There's nothing wrong with exploring new things but right now all you do is ranting about the syntax without giving any examples of things that are "bad" and honestly it makes you sound a bit like one of those designers redesigning everything just for the sake of redesigning. > And even ; to end the line. Why do people even hate ; ? It gives you better error messages and it's no different from using . to end a sentence in spoken languages. > Use Whitespace When you make whitespace important the only thing you gain is that it forces people to format their code (see Python) but it also often leads to idiotic decisions (e.g. Nim not allowing tabs which are simply superior to spaces, there is literally not one reason to ever indent with spaces). C++ and co have the right idea, the only thing whitespace should do is separate tokens then people can format the code as they see fit. > Try unicode glyphs for different syntactic functions Now sure Unicode stuff can make things more readable in some cases but the big problem of Unicode is how you input those things. Your keyboard is basically ASCII, that leaves you with some workarounds like ALT codes or Julia's LaTeX conversion stuff. And those things are not supported on every platform/editor. Not to mention that for some things you need to install a new font or whatever. > try to approximate natural language What would you like to see? I don't see what you'd gain from that except mostly making things more verbose. Spoken languages are quite different from programming languages. As soon as you have a large block of instructions (aka a program) you naturally resort to some kind of structuring (e.g. making a list that someone else has to check from the top) and that will pretty much look like pseudo code already. Sure you'd do something like `list.add(foo)` instead of "Add foo to the list" but that's just because the former is much easier to parse and encode into rules for the computer.
- skohan 4y ago> C++ is a low-level language, meaning that theoretically, it cannot be beat; given unlimited time, you can optimize C++ code enough to beat anything. That's just untrue right? You would have more room to optimize writing assembly directly?
- Santosh83 4y agoI guess that statement is comparing C++ with other high level languages. Not assembly. After all, one can drop down to assembly from any language. But "theoretically" is not interesting. What's more interesting is what is practically possible. Even Python can be made as fast as assembly by writing everything in the latter inside a Python shell, but those are unrealistic comparisons. Practically speaking C++ is difficult to beat, in terms of speed, from other languages at a similar level of abstraction.
- skohan 4y agoYeah but the point would be, if you can beat C++ with assembly, then theoretically there can exist a compiler for another language which can compile to that same assembly, meaning C++ isn't at the theoretical limit. Maybe it's a nitpick, but it gives me a little bit of pause to see a statement like this on a language website's page, since it seems to indicate a bit of a weak or sloppy understanding of computer science fundamentals.
- nine_k 4y agoHand-optimizing assembly becomes too hard for humans past certain size, which is not yet too large for LLVM, GCC, or ICC. OTOH Fortran (and, I suppose, something like APL / K / Q) can generate faster code than C++ because Fortran guarantees the absence of aliasing. In C or C++, aliasing precludes certain kinds of optimizations, and proving the absence of aliasing at a particular spot may be too time-consuming (if tractable at all) for the compiler to try.
- azakai 4y agoThe key mechanism for memory safety, generational references, is described here: https://verdagon.dev/blog/generational-references https://verdagon.dev/blog/generational-references IIUC it's basically a form of memory tagging in userspace, but designed to be safe (64 bits, very low risk of collision) and fast (language is designed to avoid tagging whenever possible: owning refs don't need them; inline objects reuse the gen of the parent; static analysis). I buy that this can be almost as safe as reference counting or GC, and as easy to use, but faster. But not sure I understand how inline objects work, and how effective static analysis will be is important. Comparisons to other languages (C++/Rust/JS) are here: https://vale.dev/comparisons https://vale.dev/comparisons
- flockonus 4y agoInterestingly the article misses the comparison with Go, which quite similar to it, and in fact I'd argue - easy, fast, safe.
- sumy23 4y agoGo has GC and a runtime, which this might not have?
- xedrac 4y agoGo is easy, decently fast, and reasonably safe. It's a good tool for many problems. Rust is complex, extremely fast, and notably safer than Go. It sounds like Vale is trying to push the envelope of what is possible, which to me, means having a simple yet expressive, extremely fast, and extremely safe language. Go makes compromises in all of those areas (as do many other good languages). I'd argue that Go isn't really near the boundaries in any of those areas, so it's not surprising that they didn't use it as a comparison to illustrate those three aspects of a programming language. It seems Vale's goal is to have their cake and eat it too.
- throwaway894345 4y agoAgreed that Go trades off some performance and safety. I’m not sure what “easy” means exactly, but IMO Go has the shortest learning curves of any language whether “time to productivity” or “time to mastery” and it also has the fastest developer velocity IMO (and I’m coming from Python, which has that reputation as well). It seems like Go is at the boundary for anything worth calling “easy”.
- ilikehurdles 4y agoDoes it have higher order functions?
- verdagon 4y agoIt does, currently in the form of IFunction1<R, P>, IFunction2<R, P1, P2>, etc. We also just introduced variadic generics in version 0.2, which is the first step towards a unified IFunction<R, ...> interface. Long term, we'll have syntactic sugar for it: func(...)R
- dang 4y agoRelated: The Vale Programming Language - https://news.ycombinator.com/item?id=25160202 https://news.ycombinator.com/item?id=25160202 - Nov 2020 (171 comments) The Next Steps for Single Ownership and RAII - https://news.ycombinator.com/item?id=23865674 https://news.ycombinator.com/item?id=23865674 - July 2020 (38 comments)
- verdagon 4y agoVale lead here, thanks for posting! For those interested in the PL space, here are some of the shenanigans we've been up to in Vale: * We added "Higher RAII", a form of linear typing that allows destructors to have return types and parameters. [0] * We just yesterday finished the first prototype of deterministic replayability, which will allow us to capture all inputs to a program (including all network data, user input, file input, etc, and eventually, even thread orderings). No article yet, but our docs on it are pretty approachable. [1] * Last month, we finished the first milestone of "Fearless FFI", which lets us call into our C code without fearing it corrupting our Vale data. Later on, we'll be adding automatic sandboxing, either via subprocesses (using IPC for FFI) or wasm2c (which should be a lot faster). We've also got some interesting plans for concurrency. We've found a possible way to make memory-safe and data-race-safe structured concurrency even easier, [2] which I hope to get prototyped before the year's end. As a fan of C++ and Rust, I'm most excited about having the RAII and flexibility of C++ with the memory safety and data-race safety of Rust, while being easier than either of them. We seem to be succeeding, hopefully that continues! I also want to emphasize that Vale is a work in progress, and we endeavor to be very clear on the site about which parts are implemented and which parts aren't. We couldn't have gotten this far this without our sponsors' support, so big thanks to all of them! [3] [0] https://verdagon.dev/blog/higher-raii-7drl https://verdagon.dev/blog/higher-raii-7drl [1] https://github.com/ValeLang/Vale/blob/master/docs/PerfectReplayability.md https://github.com/ValeLang/Vale/blob/master/docs/PerfectRep... [2] https://verdagon.dev/blog/seamless-fearless-structured-concurrency https://verdagon.dev/blog/seamless-fearless-structured-concu... [3] https://github.com/sponsors/ValeLang https://github.com/sponsors/ValeLang
- ppeetteerr 4y agoHey! Cool language. Well done
- carterschonwald 4y agoVale definitely has some interesting ideas! Time permitting I strongly encourage you to figure out writing down some semi formal full descriptions of some of these ideas to help share them. They are fascinating takes on ideas.
- riffraff 4y agoFor anyone that was confused like me, this is unrelated to the Vala programming language [0] which is a more traditional OO based on GLib. E vs A. Looks very interesting, and the blog has very nice writeups, I found the article on mutable/constant variables syntax[1] particularly clever. Tho I'm unconvinced of the final decision it's certainly a breath of fresh air. [0] https://en.m.wikipedia.org/wiki/Vala_(programming_language) https://en.m.wikipedia.org/wiki/Vala_(programming_language) [1] https://verdagon.dev/blog/on-removing-let-let-mut https://verdagon.dev/blog/on-removing-let-let-mut
- giancarlostoro 4y agoJust had a thought. I wonder if Vala would of been better off as just a project adding GLib support to D and just maintaining that link. Vala is amazing at what it does but then you get an even richer language in my opinion to work on top off with less overhead. Not to knock on Vala I appreciate it for what it is. It is also the main reason why ElementaryOS has some amazing applications out of the box.
- topspin 4y agoThe language creator(s) don't appear to have pretentions of displacing the entire world. Look at this quote: "Vale is powerful enough to use, and it feels really good to finally use Higher RAII in a real-life program. It's an incredibly versatile and valuable pattern, one that I hope Vale will bring into the mainstream!" Bring [Higher RAII] to the mainstream. It's a sandbox to experiment with a composition of ideas in the hope that some of these ideas influence the 'mainstream' including, perhaps, D. The number of new, fast, safe (for some value of safe) native languages that are appearing is amazing. I think this is down to powerful tools for creating native languages. We're in a new era of language development; the yawning gulf between C/C++ and the world of managed/scripting languages is being rapidly filled. This shouldn't be discouraged with "why not just make my preferred thing better?" Eventually it will.
- Hasnep 4y agoGP that you're replying to is talking about Vala, not Vale
- ashish_negi_ 4y ago@verdagon Can you please explain https://verdagon.dev/blog/generational-references https://verdagon.dev/blog/generational-references comment that: "programs dereference less than they alias and dealias" ? Does deference means accessing a field of object ? Does alias/dealias mean creating/destroying another variable reference ? If answer of above is true, isn't programs deference more than alias/dealias ? i mean, in: var alias = shared_ptr_of_some_object; for (int i = 0; i < 1000; ++i) { alias.foo += bar_fn(alias.baz) } is just creating 1 alias but defrences 1k times and above looks like very typical code.
- verdagon 4y agoYep, thats what we mean with dereferencing, aliasing, and dealiasing. That statement is referring to our sample program, a roguelike game that we use for benchmarking. As for why this is the case, I'm not sure! I suspect its because a lot of classes will alias/dealias objects without ever dereferencing them, such as List<T>, HashMap<T>, etc.
- sumy23 4y agoQuestion: it looks like the generational memory strategy prevents use-after-free bugs at runtime, which is nice, but a language like Rust prevents these kind of bugs at compile time. Am I missing something, or is Rust fundamentally safer than Vale?
- darthrupert 4y agoWhy would a run-time check make anything less safe than a compile-time check, if they perform the same check?
- rich_sasha 4y agoBecause at runtime you find out about the bug only when it occurs. A compile type check fails to compile the buggy code.
- darthrupert 4y agoAh yes, I see. Strictly speaking, both are exactly as safe, since safety is about whether unsafe actions can be done. It does not matter at which point the unsafe action is stopped. But it could have some implications for software stability (compile time being obviously better) and productivity (run time being obviously better).
- yaantc 4y ago> It does not matter at which point the unsafe action is stopped. It does in practice. With a compile time check the issue simply cannot happen, and there is no need to deal with it in the code or at system level. With a runtime check the issue may happen, but will be detected when it does. Still, the choice then is either to crash or to deal with it with some runtime recovery action. Either way has some cost: the system around the executable must deal with more crashes, or the code gets more complex (and sometimes more brittle, even if the intention is the opposite). Only the compile time check makes an issue really go away. This is to me the attraction of strong typing and any form of compilation time check. There's a price to pay too in accepting the related constraints: type checking must pass. So there's a cost here too. For complex or sensitive applications I personally much prefer this upfront cost. But it's definitely not the only way: Erlang has runtime type checks, but a very good runtime error handling framework (the reference?), and it works well. Still, most environment relying on runtime checks are not at this level.
- kitd 4y agoInteresting to read about variable mutability here: https://verdagon.dev/blog/on-removing-let-let-mut https://verdagon.dev/blog/on-removing-let-let-mut Originally there was let and let mut like Rust. But that was changed to simple assignments, followed by the compiler checking for subsequent reassignment with set. While I can see that might make for cleaner code while still allowing the compiler to get on with its job, surely one of the benefits of explicitly immutability is to stop the coder accidentally letting off foot guns. If simply setting a variable after declaration makes it mutable, it feels like it could open the door to data in a code block being allowed to change behind the scenes when the assumption in that block is that it is fixed. I'd be interested to know how this works in every day practice and possible unintended effects.
- junon 4y agoAgreed, I otherwise love the language just at face value but this was a big "ehhh" for me. I'd rather be boxed in and have to opt-into increasing bug surface area.
- christophilus 4y agoAgreed. Seeing const vs let when reading / writing TypeScript gives me a clear, explicit indication of intent. I like having this be explicit.
- prirun 4y agoPersonally, I don't like these two kinds of syntax for declaring and assigning a mutable variable, because if code is moved around - which happens all the time - I have to switch the syntax for declaration vs assignment. Same thing with Go's := and =.
- imtringued 4y agoThe vast majority of variables in your program won't be mutable or be changed around so why add the mental burden of mutability on every single variable just for some tiny minority of cases?
- 4y ago
- bryanrasmussen 4y agowhenever I see a list of properties like this I always add 'choose two' in my mind. In my experience it's generally easy that gets dropped, reading the site I don't think there was anything there that made me think this is easier to learn than other mainstream programming languages so I think that's the case here as well.
- christophilus 4y agoIt just needs to be easier than Rust and C++, and more expressive than Go while being nearly as performant. If it comes with a good stdlib, even better.
- Squonk42 4y agoGiven the possible confusion with Vale[1] and Vala[2], I suggest to rename the language to some new unambiguous name asap in order get more visibility. Otherwise, it looks very promising! [1] https://github.com/project-everest/vale https://github.com/project-everest/vale [2] https://en.m.wikipedia.org/wiki/Vala_(programming_language) https://en.m.wikipedia.org/wiki/Vala_(programming_language)
- sandruso 4y agoGithub may show a warning when creating repo about all possible name collisions. We see this problem often. If anybody from GH is listening :)
- TobTobXX 4y agoGitHub already has a feature to check if any public GH repo has this name. They've called it search.
- vaylian 4y agoI don't think this is really a problem. I know Vala and I don't see a problem with confusing the two.
- rat9988 4y agoIt's because you know Vala that you don't see the problem.
- davidkunz 4y agoI didn't confuse it with Vala, but with Val: https://github.com/val-lang/val https://github.com/val-lang/val
- Squonk42 4y agoWhy are semicolons mandatory? Wouldn't be cleaner without this restriction, like in Kotlin?
- verdagon 4y agoA valid question! Semicolons and other forms of syntactic redundancy often enable much better error messages. We're leaning towards keeping them in Vale. However, we can always change our minds later and make them optional, so it seems wise to just require them for now and revisit later.
- pca006132 4y agoSorry but I don't quite get it. It seems that generational reference is a way of memory tagging that avoids users from use-after-free, while reference counting is a way of tracking the number of references to an object and free it when it is no longer reachable. It seems to me that generational reference isn't replacing reference counting as it is not deciding when to free the object? Perhaps this is more like a weak reference or something?
- azakai 4y agoThey are very different in those respects, correct. But I think the point here is that both are ways of achieving memory safety.
- pca006132 4y agoSo the non-owning references are kind of like weak reference but not implemented with Rc? I guess I now understand its purpose. Wondering how does this deal with multithread though. For example, the object A might be dropped in thread 1 (increments the generation number in thread 1) and accessed in thread 2 (reads the generation number). How do they guarantee an error in this case without using atomics? (although this might not be a valid question because you can't really say A is dropped before thread 2 accessing A without some sort of synchronization...)
- Santosh83 4y agoComparison of Vale with C++, Javascript and Rust, with detailed explanation of how it aims to do things differently in the three categories of speed, safety and ease of use. https://vale.dev/comparisons https://vale.dev/comparisons
- projektfu 4y agoIs it pronounced va'-lay [1] or vehl [2] 1. Vale: it's worth it, fine, in Spanish 2. Vale: an area of lowland between hills or mountains, in English
- blacksqr 4y agoAve, Vale!