3 ms·
You also just need to be disciplined to calculate the structural integrity of a bridge in your head, yet civil engineers learned the hard way that bridges colla
by atoav 5y ago
You also just need to be disciplined to calculate the structural integrity of a bridge in your head, yet civil engineers learned the hard way that bridges collapse independently of how genius they thought they were.
Using design systems (languages) that eliminate entire classes of mistakes, because they make them impossible is the rational choice. It is human to make mistakes, but how we learn from the past to prevent mistakes in the future is where you can tell between engineers who truly care and those who are in it for their own ego.
- analog31 5y agoIndeed, and it points to why there are multiple languages, because features that eliminate one class of mistakes can make it harder to eliminate another class. For instance, a mistake might be a spelling error in an identifier, or it might be a program that does completely the wrong thing because it was too hard to read, or that does nothing because it took too long to write.
- kaba0 5y agoI’m absolutely in support of various compile time enforced constraints on languages, but do not forget that the field we are in has unbounded complexity. So after a certain range they have diminishing returns. (Eg. types are a trivial property that can be checked through arbitrary code bases, but race conditions and a litany of other bugs are not. Introducing harder and harder concepts to try to claim a tiny formal verification will quickly become diminishing returns at the price of a much complex language z)
- pdimitar 5y agoI don't disagree. The problem is that people stop with the better practices (like statically strongly typed languages) and increased coverage/branch testing veeeeeeeeery long before they hit the diminishing returns. That's the crux of the issue most of the times: "eh, good enough". Additionally, I really want us to stop pretending we can program CPUs directly (and I include the higher-level languages here as well, not just machine code and assembly). We can't. We need more declarative languages, e.g. I want to be able to say "I want to open a huge file with scatter-gather mechanics and with these 3 functions piped that do mapping and reduction". Why should we always code this by hand? There are objective best ways to produce this code in most languages. Let's have a DSL library that allows us to express that intent and be done with it and move on to be productive on another task. This is not done enough to this day. Various people and organizations are doing it here and there and to me they are the beacons of our future hope. Everybody else is just banging at their Emacs / VIM in the meantime.
- TheMonarchist 5y ago> I want to be able to say "I want to open a huge file with scatter-gather mechanics and with these 3 functions piped that do mapping and reduction". IME C++ templates and generic programming help with that aim.
- pdimitar 5y agoVery far from it. I get what you're saying but it's not even close IMO.
- selestify 5y ago> Various people and organizations are doing it here and there and to me they are the beacons of our future hope. Who are these people and organizations?
- pdimitar 5y agoYou can join me in a mourning session because when I stumbled upon them years ago I never took the effort of so much even writing down their names so now it's a blank stare from me, sorry... :(
- cle 5y agoI would consider coding these things by hand in the following non-exhaustive cases: - I am writing the thing you are asking someone to write - I have performance/memory constraints that existing high-level abstractions can’t adequately deal with - I have legal or other business constraints preventing me from using existing high level tools (eg company prefers to build in house to minimize dependency risk exposure) - I want to learn how that stuff works - I am working on new technology that does not fit cleanly into the prescribed mold of the high level implementations
- pdimitar 5y agoRE: your second point, it can easily be covered by a declarative DSL with a few conditions (in macros / code generating constructs). Example: in Elixir you have the so-called streaming functions you can pipe to each other that can do e.g. filtering, mapping, chunking and what not. But they don't actually operate on the data you passed them; they generate further functions and produce chains that only start working when you put a certain command at the end of the command pipe. This works really well if you work with a collection of 100_000 elements. Since Elixir is an FP language, you don't want to copy this huge list, say, 7 times one after another (assuming your transformation pipe has 7 stages). By using the streaming functions you only use the original list and produce a final list. Just one roundtrip to the memory. But... it has a performance impact and it's definitely not worth doing if your collections are e.g. less than 1000 elements, maybe even 2000. A declarative DSL can easily cover for such cases and have separate code branches addressing them. RE: tinkering, obviously. I am not saying normal programming should be "banned". But it's about time we have higher-order programming, man. We're all collectively slacking off on that and should be really ashamed! The rest of your points I don't see how to automate and that's OK. Like any tool, declarative programming should be used sparingly and only where it truly applies.
- tialaramex 5y agoRace conditions aren't preventable as a general phenomenon, they're something real in our world, if you put the cat out the front door and then walk to the kitchen and close the kitchen door, the cat may meanwhile run around the building and back in through the kitchen door, so, don't do that. However data races (a small but important subset of race conditions in concurrent software) are preventable, and so you can use languages which do so. Unlike the cat race condition I described above, data races are often unfathomable in real systems, the ultimate cause of truly mysterious and hard to reproduce bugs. So they're very much worth preventing. Anyway, while it is true that "unbounded complexity" is potentially necessary, tools capable of such power should not be the default. When I spread jam on toast, I don't use the butcher's cleaver, I use a butter knife that's too blunt to cut flesh let alone bone. Which means, if I screw up the worst case is maybe I get jam on the carpet instead of the toast, not I cut my own hand off. That difference in tooling can exist both within a language, and also between languages. There are many programs you cannot write in WUFFS, whereas there are (almost) no programs you can't write in C++. But that actually means we should use WUFFS when we can, because we don't want those programs. The image viewer where PNG files with long rectangular orange areas cause the hard disk to get reformatted, easily possible in C++ and not WUFFS. We don't want that program. The icon maker where a JPEG text comment with a shell script in it executes the script, easily possible in C++, not in WUFFS. Don't want that either.
- kaba0 5y agoI think we are not in disagreement - I am absolutely for static types and even for some notion of ownerships a la Rust, but for example dependent types may not be worth the extra mental overhead/arguings with the compiler.
- ReleaseCandidat 5y agoDepends what you're used to. For me dependent types (like in Coq) are a way more natural way of thinking than Rust's affine types.
- marcosdumay 5y agoAre you sure dependent types don't make your programs simpler instead of more complex? A more powerful type system making programs simpler isn't anything new. I personally haven't seen them simply anything yet, but your assumption that verifying things with a dependent type would necessarily result in more complexity than a non-verified program is not trivial and needs support.
- posix86 5y agoNot yet, right? This is a topic of active research.