1,706 karma · joined Dec 9, 2019 (6y ago) · 623 submissions
comment 4y ago · link · parent
>Also worth noting i read an interview with a restaurant owner near the target whos restaurant was burned down that effectivly said "yeah this really really sucks, but at the same time i understand the wider context." That's what happens when you're actually a member of the community and get caught up the fallout from these things
No, what this means is that this owner is privileged enough that this isn't life ruining to them. A lot of small business owners in poor areas have partial coverage at best and will never recover, having their store burned down is having their livelihood burned down.
comment 4y ago · link · parent
I implicitly assumed that state would be encapsulated, since after all dependent types are fundamentally incompatible with observable state, but you're right that this is part of the spec. However I have severe doubts about the usability of any specification language that takes more than a one-liner to specify this.
>You also have to specify what happens for general sorting predicates
If you want to admit more general sorting predicates, sure, but normally you'd just allow pure functions.
>The sorting example shows that this largely doesn't work in practise. In my experience for non-trivial programs you tend to have to carry around invariants whose complexity matches the size of the program you are verifying.
If you include lemmas derived from the spec then I'd agree, but then the spec you have to check would still be a lot smaller. If not, then the only specs where I've experienced anything close to this are ones that are just the operational semantics of existing programs i.e. cases where you want to analyze a specific program. Otherwise I'm frankly uncertain as to what even the point of giving a spec would be.
>Haskell and Scala have (local) type-inference. That makes those complex types (somewhat) digestible.
Might make it more tractable to use, but I find my issue is that it's less direct and often obfuscates the meaning.
comment 4y ago · link · parent
comment 4y ago · link · parent
I feel that is much too pessimistic.
>will only cover a small case of the actual specification.
If the same applies to proofs: so be it. Don't let perfect be the enemy of good!
>For example I would bet money that not a single function in the C, C++, Java and Python standard libraries is fully specified, in the sense of nailing down the program up to observational equivalence.
I'd imagine so as well, but I think that's more indicative of how even a (superficially) simple language like C is not all that amenable to specification.
> A lot of code refactoring I've done was trivial (e.g. changing the order or arguments), but ripples through the program and proof structure.
This is not my experience. If you use sufficient proof automation, something like this should have next to no impact on proof structure. Univalence is useful, but a lot of refactoring is not just switching to isomorphic representations, so I'm convinced that larger scale proof automation is way more essential than HoTT.
> Java exception specifications
I'm not convinced that this is fundamental to specifying exceptions rather than just Java having particularly poor ergonomics for it. I've never met a person that actually liked implicit exceptions and if you ask people who dislike exceptions, that's often one key part of it.
> In contrast, expressive type-theories constantly force you to prove a lot of trivialities.
For all large dependently typed languages that actually bill themselves as programming languages (Agda, Idris, Lean) there is some sort of 'unsafe' feature that allows you to turn the termination checker off - at your own peril of course. But you only pay for what you use, if you don't need the additional correctness, you don't need to put in any more work, just like with unit tests.
(There are also ways to safely defer termination proofs, but to be fair the experience isn't the best currently.)
>I don't know what you mean by declarative (other than: leaving out some detail).
Specs tell you the what but not (necessarily) the how. Take the spec for all sorting algorithms (giving observational equivalence):
1. The output list is a permutation of the input
2. The output is sorted in regards to some predicate.
That's a couple lines at most (or a one-liner if you don't count the building blocks like the definition of a permutation), which is a good amount shorter and easier to verify than e.g. a full heapsort implementation.
>But they cannot be smaller in general: if every program P had a full specification S that was shorter [...] then you've an impossibly strong compressor
The compression is stripping away the 'how', that's why you can't 'write a spec for a spec' and compress further.
>What you see in practise is that you only specify some properties of the program you are working on.
Sure, writing a fully specified program of non-trivial size is currently really only possible if you're willing to ~waste~ invest a decade or more.
>Moreover, if you only work with a partial specification, you can ask the question: what level of partiality in my specification gives me the best software engineering results.
Why would you assume that there is a single level of partiality that gives the best results? I agree that HM style types are a great fit for 'general' programming because it has such low impedance, however I also believe that most programs have some areas where they would benefit from more specification. (I think people have a clear desire for this and that it's at least partially responsible for some of the crazy type hackery as seen in Haskell or Scala, which could often be greatly simplified with a richer type system.)
Having a richer type system doesn't mean that you always have to fully use it. It's perfectly possible to just use a HM style/System F fragment. Using dependent types just for refinement is already one of the dominant styles for verification. If dependent types ever become mainstream in any way, I imagine it will also be largely in that style.
comment 4y ago · link · parent
Otherwise, since Assembly provides the most control out of all, would you consider it the most expressive? ;-)
comment 4y ago · link · parent
Yes, just like you have to evolve your specification/documentation. Similarly, in the exploratory phase you'll stick to very 'rough' typing and next to no proofs and as the program gets clearer and solidifies, you can continuously refine your types (with the amount of refinement depending on how much certainty one wants). A mature program with a rigid spec is going to be harder to change, but that's just how it is anyway.
>Moreover proofs are non-compositional: you make a tiny change somewhere and you might have to change all proofs.
People on HN keep repeating this, but it's trivial because it's actually just a statement about the nature of properties. Proven invariants provide an interface to be used by the rest of the program. If the changes you make don't break your invariants but only the proofs, then you just have local adjustments to make. If your change cascades through the entire program, then it's because all the invariants get invalidated and your 'tiny' change actually changes a good deal about the semantics (and thus the spec) of the program.
The exact same thing applies to unit tests, but you don't see people constantly bemoan the non-compositional nature of unit tests even though a 'tiny' change could break all your unit tests.
>After all, your specification is just as likely to be buggy as your implementation code.
Not only are specifications declarative, they're generally magnitudes smaller. If you're as confident in your spec as in your code, something is very, very wrong with your spec. Well, or your code is your spec, but in that case you get what you pay for.
comment 4y ago · link · parent
>Programming languages are not theoretical things. They're concrete, practical tools that _enable_ other stuff. Engineering, not science.
You can't escape theory, engineering is applied science.
comment 4y ago · link · parent
This is the earliest google hit for "Ten Commandments for egoless programming".
Curiously, the author, Lamont Adams, does not explicitly state that the commandments are from the book. Maybe "I present The (Almost) Ten Commandments for egoless programming" means that it's a summary by Adams?
comment 4y ago · link · parent
The famous monopoly cases (e.g. Standard oil or Bell system) also had tons of customers, that's what happens when demand is rather inelastic. If you want to say that artificially inflated prices due to e.g. a monopoly can still be a good deal because people are still willing to buy it, then we shouldn't be content with just good deals because they still cause harm to society overall by not being pareto efficient. Apple can't charge the rate they do purely by the strength of their distribution service - it's the device base that is the real value and only by anti-competitive measures can they keep the price up.
>But it is not. You can reach your user via Web or if they are mobile via Android or Windows phone.
What if Apple also decided that every transaction made through their browser had to give them a cut? The situation doesn't fundamentally change (you could still just offer your app to android/desktop users), but I think it's pretty clear that this would be anti-competitive. They might not have a monopoly on smartphones/devices, but they have such a large share that boycotting them isn't really an option.
Users are also currently funneled into apps due to how web is limited in functionality as determined by Apple. e.g. if your app needs long term local storage you now need an 'real' app because Apple changed it so that web app local storage gets cleared on the regular. Windows phone has also been dead for years now.
comment 4y ago · link · parent
And you can frame it however you want, the price for iOS distribution is not determined by market forces because there is no competition for it. Distributing an application on android is not an alternative, but complimentary. It's like if there were two delivery services in the US, each covering one part of the country. It doesn't matter that there isn't only one delivery service, both of them still have a monopoly because they're not competing in regards to what they actually sell.
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
Accurately voicing my thoughts on this would probably go against the HN guidelines, so I'll just let this sentence from the article speak for itself:
>But our vision is a grand one—unify all of computation into a single coherent language, and for that, the FOSS development model is not well suited.
Well, good luck with that.
comment 4y ago · link · parent
This strikes me as an unusual definition. I'd say that references are simply a pointer that is treated like the underlying value i.e. they're 'boxed' values. This is a notion that is essentially present in all languages. e.g. Java (or Scheme) which don't have some explicit reference feature, still have 'unboxed' values (e.g. integers) and 'boxed' values (e.g. lists).
>They deal with bindings.
Sure, to create a closure, you need to capture the relevant bindings (the lexical environment). But how does on deal with bindings? Well, a binding associates a variable to a value. Now, when you capture a binding, you can either point to the original binding (capture by reference) or copy the value (capture by value).
>Why would you have to be wary about lifetimes?
I mean, that's just how these languages are, right? Even if you do something incredibly mundane, like returning a value or calling a function with a parameter, you constantly have to be aware of lifetimes. That's why to me it seems like a completely orthogonal issue to closures.
comment 4y ago · link · parent
I've found the official documentation to be very detailed, so it's helpful if you really need in-depth knowledge, but if you don't it's a bit hard to parse out the relevant bits. Copying something from the official guides seems often the easiest way...
In regards to the community, I didn't find it to be much smaller? The stack overflow tag is very active. I have the same experience that nobody I know wants to learn Spring out of their own volition though.
comment 4y ago · link · parent
>at least a differently scoped variable of the same name referring to the same value, but that's not lexical scoping anymore
not lexical scoping? That's literally just how closures work under the hood.
And that's exactly why closures have to deal with references (or copies) - every implementation of them is a function pointer and a record for the lexical environment, the latter of which requires that at closure creation time the relevant bindings are captured, either by creating a reference or making a copy.
I also don't understand why C++'s (or Rust's) closures would be 'fake'. If you capture by reference, they work exactly like the closures of other languages. Not having a GC just means you have to be wary of lifetimes. If you use a reference counting pointer (/some other GC'd pointer) you literally have the same closures as other languages.
comment 4y ago · link · parent
e.g. in C++, where one has to make capture by reference explicit
int i = 0;
auto f = [x = i, &y = i] { //x captures i by value, y by reference
std::cout << "Value:" << x << ", Reference:" << y;
};
i++;
f();
will print out "Value: 0, Reference: 1".comment 4y ago · link · parent
Using gold as your currency also isn't mercantilism. Mercantilism is about increasing exports while reducing imports. e.g. China today is quite mercantilist, despite not using gold.
comment 4y ago · link · parent
It's not a huge deal, because working with indices works well enough, but it is a bit annoying.
comment 4y ago · link · parent
>Also you’d have to explain how bailing out banks that made poor quality loans and are on the risk of insolvency isn’t “rewarding bad quality loans”.
It is, to an extent, but a loan is much less of a reward than someone paying off your debt. That's also why new regulations were introduced so that future behavior likes this from banks wasn't incentivized.