Better HN
topnewbestaskshowjobs
Log inSign up

syn_rst

184 karma · joined Sep 19, 2017 (9y ago) · 20 submissions

Submissions

comment 7y ago · link · parent

They may not be intrinsically more sacred than anything else, but ads in general are still something to avoid. The difference in reaction when adding a new ad to the web vs the CLI is analogous to dumping trash in an abandoned building vs in the middle of the forest. They're both bad, but the CLI/forest feels worse because it's mostly untouched, whereas the web is already thoroughly infested with ads.

2.

Let's Build a Compiler(generalproblem.net ↗)

363 points · by syn_rst · 7y ago · 47 comments

comment 7y ago · link · parent

I didn't see that, but it might be because I block JS in general by default.

comment 7y ago · link · parent

Depending on what syntax constructs are available, it's possible to achieve clarity without the verbosity or "line noise factor." For example, in Rust you could write that same code as:

  match a.cmp(&b) {
      Ordering::Equal => 0,
      Ordering::Greater => 1,
      Ordering::Less => -1
  }
It's easy to see what the possible outputs are and what is produced in each case. The compiler even checks it to make sure you didn't forget any situations.

The clarity comes at the cost of some verbosity, but there's only 4 lines of functional code (not counting the closing brace) here compared to the article's 10. You'd get around the same number if you added line breaks to make the ternary example more readable.

comment 7y ago · link · parent

WSL fails in a lot of use cases due to the NT kernel's poor performance when creating processes, slowness in the translation layer when accessing files, and the like.

It's essentially the reverse case of telling Windows users to "just use Wine" - the emulation isn't perfect and some programs won't work well or at all. In a sense, WSL is worse than Wine in this regard since there's usually a Linux-native alternative if something doesn't work in Wine. If something doesn't work in WSL, you don't have a lot of options.

comment 7y ago · link · parent

I don't really like it either, but the "future use for expression-oriented operators" aspect makes it easier to swallow. I'd rather deal with some slightly odd notation that accurately represents what's going on than have a bunch of different syntactic constructs for different postfix operations.

comment 7y ago · link · parent

I built a workstation with a Threadripper earlier this year, and I couldn't be happier so far. The single-core performance advantage of Intel parts isn't that big, and you get a ton of cores and PCIe lanes in exchange.

comment 8y ago · link · parent

Like this:

  fn leak() {
      // Create a 1KiB heap-allocated vector
      let b = Box::new(vec![0u8; 1024]);
      // Turn it into a raw pointer
      let p = Box::into_raw(b);
      // Then leak the pointer
  }
Obviously that's kind of blatant, but there are more subtle ways to leak memory. Memory leaks aren't considered unsafe, so even though they're undesirable the compiler doesn't guarantee you won't have any.

Reference cycles when using Rc<T> are a big one, but generally it's pretty hard to cause leaks by accident. I've only run into one instance of leaking memory outside of unsafe code, and that was caused by a library issue.

comment 8y ago · link · parent

Switching distros seems a little drastic given the problem. Why not just fix the AUR package? That'd probably take less time than reconfiguring everything.

comment 8y ago · link · parent

You're considering network transmission time, by which cached JS is indeed free, but ignoring parse/JIT time and CPU usage as factors. Processors aren't getting any faster, and all that client-side rendering code has a very real cost in terms of compute-bound work for the user's hardware. Processors aren't getting any faster.

The usual answer I've heard here is to use an SPA, but those have problems of their own. They chew up huge amounts of memory if you use tabs, their UX is worse than if you'd just built normal webpages, you have to deal with making it indexable, and so on.

Honestly, I'd be ecstatic if most pages loaded in two or three network round-trips. A cold request takes maybe 100ms when I'm on a cell connection, but JS-heavy pages I've seen tend to have load times measured in seconds.

comment 8y ago · link · parent

I'm pretty happy about the GlobalAllocator stabilization. Now you can run Massif and Heaptrack on rust code without switching to unstable!

comment 8y ago · link · parent

"Command and Control: Nuclear Weapons, the Damascus Accident, and the Illusion of Safety" is pretty good. I read it a while back after seeing it linked here.

https://www.amazon.com/dp/B00C5R7F8G?ref_=k4w_ss_dp_lp

comment 8y ago · link · parent

That's exactly the problem: they work well enough for some limited applications. Thing is, "well enough" isn't a reason to get people moving to MS's platform - if I already have a great dev environment that runs on Mac or Linux, why would I switch? I already have perfect integration between my CLI tools and the OS, first-class support in a lot of FOSS projects, and a strong community around the platform, all of which I'd lose if I switched. In exchange I'd gain nothing but the numerous headaches (forced updates, spyware, in-OS ads, general cruft and legacy baggage, etc) of Windows.

"Good enough" might stop people switching away from the platform, but it's not enough to bring back those who've already left. If Microsoft wants to bring people back to Windows as opposed to just stopping the bleeding, they'll have to deliver an experience that's actually superior to the other platforms. Given the current state of Windows 10, I don't think they'll have an easy time pulling that off.

comment 8y ago · link · parent

It doesn't get more web-scale than `/dev/null`. Unlimited throughout, zero latency, full availability and consistency even in the presence of partitions, and constant network usage for any number of nodes!

There's a chance of data loss, of course, but the write performance is so good that it's a perfect fit for workloads like analytics or logging.

comment 8y ago · link · parent

I've run into it before, but it's not usually too serious. It only usually happens on lines with compound expressions or chained calls like this:

  foo.into_iter().map(|x| x+1)
     .filter(|y| y > 2)
My working theory is that it's related to situations where there's multiple statements on the same source line (or inside a block inside a lambda).

comment 8y ago · link · parent

I've been thinking about switching to either FastMail or ProtonMail for a while, and an open-source client solution for Linux would eliminate the only remaining reservations I have (inability to use mutt and running unauditable JS with access to the password) without giving up security.

comment 8y ago · link · parent

I use Pandoc (http://pandoc.org) on a regular basis for converting plaintext/Markdown documents into PDFs or Microsoft Word files.

comment 9y ago · link · parent

And yet somehow neither of them can compare to text-mode editors built more than 30 years ago.

comment 9y ago · link · parent

The hardware and OS are fine. The problem is the web platform and its towering stack of abstractions, combined with the occasional problem of focusing on aesthetics over utility.

I haven't yet experienced a web-based application that I actually enjoyed using. The closest anything ever gets is to make me wish it was a native application so I didn't have to deal with all the web nonsense in order to use it.

comment 9y ago · link · parent

Not quite. The societal acceptance of discrimination based on genome is missing, and that was a big part of Gattaca's impact.

Unless that becomes a possibility, I'm happy that we can cut down on the randomness of the genetic lottery.