Better HN
topnewbestaskshowjobs
Log inSign up

codeflo

9,664 karma · joined Jun 14, 2010 (16y ago) · 1,504 submissions

Submissions

comment 5y ago · link · parent

True, but it’s not perfect. Learners of English often don’t realize that they’re missing certain distinctions that their native language doesn’t make. Pig/pork is a common example. English has a lot of those.

comment 5y ago · link · parent

I know you’re joking, but I’m genuinely wondering, would that actually resolve the problem of (then) ancient forgery?

Our proof-of-work difficulty is trivial compared to what’s possible a few thousand years from now. So for people a million years from now to trust our records, they’d also have to trust people a thousand years from now not to simply have forged our part of the blockchain, which might be trivial for them given their hash power.

comment 5y ago · link · parent

I might be, that's not a world that's familiar to me. But I think if Google had only done that with AMP, no one would have any issue with it.

comment 5y ago · link · parent

Isn't that almost guaranteed? As far as I can tell, AMP does three things:

1. It enforces some good practices / forbids certain expensive browser features.

2. It lazily loads images only when they are scrolled in.

3. It fucks up scroll-to-top and other scrolling behavior on iOS.

The first you can do with or without AMP.

The second doesn't cause anything above the fold to load any faster. If anything, you get an additional delay until content shows up when scrolling, because the browser was prevented from continuing to download the other images in the background.

The third regularly causes me to be done with a site in just a few seconds, which I guess is an optimization of some kind.

comment 5y ago · link · parent

I'm sorry, but would you care to explain the inside baseball to the uninitiated? Who is Zach Tellman, what's a Renaissance man and how does it relate to a paragraph that doesn't mention time periods, how is this calling out Zach Tellman specifically or rather, what's the backstory there, and what does any or all of that have to do with previous criticism of Paul Graham? I'm completely lost here.

comment 5y ago · link · parent

Is there already an in-depth analysis of the M1 by someone with a low-level perspective? I want to develop an intuition on why/where the M1 is fast. E.g. is it branch prediction, reordering, memory latency. Unfortunately, most articles don’t go any deeper than “seems to be optimized for macOS”.

comment 5y ago · link · parent

It’s not a question of age, and I think you’re comparing apples to oranges a bit.

Cobol is simply kept running. Everything it does, newer languages do better. Nobody writes new systems in it.

C++ on the other hand allows you to do things that other languages simply don’t, so of course it’s still alive. New C++ projects are started every day.

A lot of actively developed languages have their niche. Python looks very elegant to mathematicians and engineers, and has fast math libraries. Java has an unmatched ecosystem. And so on.

I think PHP's niche is low barrier to entry. Maybe I'm wrong, what do you think PHP does better than other languages?

(Edit: Sorry for editing the post while you replied. I tried to word the question in a more friendly way.)

comment 5y ago · link · parent

You do have a point, I’m not the biggest fan of JS either. But notice that var is linted out of every modern JS codebase. Where’s PHP’s equivalent of let/const?

Also, I think a huge part of JS’s staying power was that besides its obvious warts, it always had a solid FP foundation as well. JS was one of the first mainstream languages with full closures. That was a powerful tool for building abstractions right from the start, and I don’t think Node.js would have happened without this.

comment 5y ago · link · parent

No, I don’t imagine that. But the fact is, PHP is very verbose and missing a lot of tools for building good abstractions compared to richer languages. If you’ve used “most of the languages” (whatever that is supposed to mean) and not realized this, I recommend you read up and reflect on the Blub Paradox:

http://www.paulgraham.com/avg.html

comment 5y ago · link · parent

I have to wonder, how big is the overlap between people who understand and want to use algebraic datatypes, and people who program in PHP?

PHP’s main selling point has always been its low barrier to entry. Introducing high-level abstractions like ADTs will hurt that user group.

At the same time, I don’t think PHP can ever catch up with high-level languages that were built on less shaky foundations (and cleaner syntax). So what’s the end goal here?

comment 6y ago · link · parent

Last year, I had the opportunity to watch Metropolis accompanied by a live orchestra. I have to say, it was quite the experience, somewhere between movie and concert, with the audience applauding after each act. It made me truly appreciate silent films as a lost form of art, I can't recommend it highly enough.

Having said that, yes, the film is not what we would today call "hard sci-fi". But a lot of the things that Wells criticizes as unrealistic are clearly intentional and meant to be symbolic, like the machines not serving any visible purpose. H. G. Wells obviously recognized this, which makes the review read a bit unfair and bitter. I wonder if there's a story behind this.

comment 6y ago · link · parent

I think that's the unfortunate consequence of people without a basic CS background inventing ad-hoc data formats. I recently had to deal with a kind of "nested CSV", where each level of nesting introduced a new delimiter! Who needs recursion?

comment 6y ago · link · parent

I personally find that manual return type annotations actually prevent some errors. A common case: I forget the return statement in one branch, and TypeScript is happy to infer something like number|undefined as the return type.

comment 6y ago · link · parent

I think you're right that this is often the case, and my heartfelt sympathies go to any engineer who struggles to do the right thing in that situation.

But in what sense are these kinds of internal politics NOT "unwillingness or inability", at least at the organizational level?

Organizations where managers are allowed to play political games at the expense of users' security are not to be trusted with any sensitive data, and need to be publicly called out and shamed if there's any hope to effect change.

comment 6y ago · link · parent

My main dev PC is running on Arch as well, and I have no intention to switch, but I'll disagree with many of the sibling comments: Arch breaks all the time.

One day, a Gnome update breaks all plugins, in one case making login in X impossible unless you manually deactivate stuff using the shell. The next time, a kernel update makes sound stop working after waking up from standby. It's mostly small regressions, and they usually get fixed a week later, but something temporarily stops working at least once every 2 months.

However, Arch also makes it much, much easier to run recent versions of, basically everything. You never have to fiddle around with 3rd-party package repos, you just install stuff and it works. It's how package managers are supposed to work, but not the experience I've ever had with Debian and Ubuntu. Of course, the fact that Pacman is fantastically fast compared to apt doesn't hurt either.

I love Arch. In aggregate, I think it prevents more headaches than it causes. But you have to be prepared for some unexpected problems and fiddling around.

comment 6y ago · link · parent

The article mentions lifetimes and cloning. A very similar argument can be made for dyn traits, where some people seem to have an irrational fear of dynamic dispatch, even where it’s a much cleaner solution, in scenarios that aren’t remotely CPU bound.

comment 6y ago · link · parent

What a brilliant article! This approach deserves be more widely known I think, thanks for the link.

comment 6y ago · link · parent

I knew that there was a proof, but never read the paper before. Now that I did, I think that proof is garbage tbh.

For Turing completeness, a fixed, constant-sized program needs to be able to handle arbitrary inputs and use arbitrary amounts of memory. It's important to distinguish the model from the implementation here. Theoretically, a language like Python is Turing complete. (And BTW you don't need infinite precision integers or anything fancy: you can simply simulate the tape with an object graph.) Practically, every Python program running on a real computer will run out of memory eventually.

Anyway, the translated Z3 programs in this paper contain one case statement for every possible memory location. This means that for a given program size, you're limited to run in O(1) space. That's only as powerful as a finite state machine, not a Turing machine.

I see nothing in the paper that convincingly addresses this limitation. There are some arguments to the effect that practical CPUs have limited address space as well. Which is true, but that argument only shows that those aren't Turing complete either, not that the Z3 magically is.

Maybe there's a subtle point that I overlooked, but at the moment, I'm simply not convinced.

comment 6y ago · link · parent

2 MLOC is insane. I assume some of that might be test code and other infrastructure, and it's basically impossible to compare apples to apples in terms of code size. But for reference, 2 MLOC is around the same code size as PostgreSQL, which is also a complex distributed system, has arguably a lot more user-exposed features and a long history, and is written in C of all things.

comment 6y ago · link · parent

I continue to be surprised that this still works, and wonder how long that'll last. It's pretty clear by this point that they're willing to try every dark UI pattern that they can think of to boost some silly engagement metrics. Community and long-term growth be damned.

comment 6y ago · link · parent

That’s because C-like languages don’t distinguish newlines from other whitespace. If you want

  foo()
    .filter(...)
    .map(...)
then you have to allow

  foo() .filter(...) .map(...)
as well, as a matter of principle.

comment 6y ago · link · parent

I’m not suggesting making this impossible - anyhow::Result has an optional second type parameter, after all. But not all code you write is “library code“, and for applications, simplified error handling is very often exactly what you want.

comment 6y ago · link · parent

I hope that std::prelude::Result becomes anyhow::Result, including the default generic argument (i.e. Result<u32> just works, no need to write Result<u32, UnnecessarilySpecificErrorType> unless you have a reason to). That would encourage examples and simple scripts to use Results and ? instead of calling unwrap and panicking. Not only would this teach better practices earlier, it would also address many of the complaints that Rust’s error handling is harder than exceptions in common usecases.

comment 6y ago · link · parent

Not having something as basic as this in the std is also a cause of painful incompatibilities and instabilities. Before anyhow became established, the ecosystem seemed to standardize on the failure crate, which was for all practical purposes basically the same thing. Making the switch wasn’t hard in my case, but also felt completely pointless.

comment 6y ago · link · parent

I think we mostly agree, but would put it a bit differently.

First, I think performance is a bit of a red-herring in this discussion. If a linear scan is really faster for five entries, a good dictionary implementation could simply switch to that.

Second, and more to the point, there’s a obviously a semantic difference between a list of pairs and a dictionary. That’s always going to be part of the “protocol” - whether your serialization format is capable of expressing that or not.

However, and I think this is where we agree, there are lots of semantic distinctions that JSON can’t express (dates vs. strings, to pick an example I encounter often). So in many cases, you’re going to have a deserialization step anyway that validates the JSON values and converts them into the objects you actually want to use in your application. Why, among all the semantic distinctions that JSON doesn’t capture, is the list/dictionary distinction so special that it needs this kind of syntactic support in a serialization format?

(BTW, for JSON, the answer is obviously rooted in JavaScript’s type system. But while that makes it particularly nice to use JSON to serialize JavaScript objects, the context here is its use as a general-purpose serialization format.)

comment 6y ago · link · parent

Very interesting. Does this mean certain optimizations run before the monomorphization step? Do you know why? Compilation performance is the obvious thing that comes to mind.
1
394041
51