HN user

MetricExpansion

108 karma
Posts0
Comments39
View on HN
No posts found.

If I understood all the semantic properties, including the separate compilation requirements, correctly, here’s how I think it would be done in Swift with the proposed nonescapable types features (needed to safely express the AsRef concept here). (Note that this doesn’t quite compile today and the syntax for nonescaping types is still a proposal.)

  @usableFromInline
  func _read(pathView: PathView) throws(IOError) -> [UInt8] {
      var file = try File(pathView)
      var bytes: [UInt8] = []
      try file.readToEnd(into: &bytes)
      return bytes
  }
  
  @inlinable
  public func read<Path>(path: borrowing Path) throws(IOError) -> [UInt8] where Path: PathViewable, Path: ~Copyable {
      try _read(pathView: path.view())
  }
  
  // Definitions...
  
  public enum IOError: Error {}
  
  public protocol PathViewable: ~Copyable {
      func view() -> PathView
  }
  
  public struct PathView: ~Escapable {}
  
  public struct File: ~Copyable {
      public init(_ pathView: borrowing PathView) throws(IOError) {
          fatalError("unimplemented")
      }
  
      public mutating func readToEnd(into buffer: inout [UInt8]) throws(IOError) {
          fatalError("unimplemented")
      }
  }

The embedded copy of Clang is doing some heavy work I think. At no point does any of the C or C++ code get transformed into Swift. Instead, it's used to import the the header directly into Swift (in a manner similar to a pre-compiled header), and then Swift is able to use the platform C calling convention to directly call the C code. Swift is generally really good at code-switching between various calling conventions, including its own, C, Objective-C msg_send, etc.

Many languages have some facility for importing declarations like that and even using C calling convention to invoke them (e.g. Rust + bindgen), but Swift goes much further than just importing declarations; if the header happens to contain C definition code, it actually compiles that code directly and then can then emit a call to it.

In the case of C++, which doesn't have a stable ABI on most platforms, it likely also knows and emits code using Clang's C++ calling convention for the platform (e.g. Clang on Windows uses the MSVC calling convention and so does Swift when calling C++). But Swift's ability to actually compile C++ code is very powerful in dealing with template functions and classes because Swift can instantiate and compile templated code in the C++ headers. AFAIK it's the only major production language I've seen that even attempts to do this.

I think this whole thread has an interesting contrast to a prior HN thread about Alcohol being unsafe at any level of consumptions and which is rated as a Group 1 carcinogen by the WHO, a much stronger designation than has been given to Aspartame: https://news.ycombinator.com/item?id=34752193

Choice quotes from the top three comments in that thread:

1) “To the extent that we expect agencies like the WHO to help us make informed, practical decisions regarding this sort of absolutist statement seems like an abdication of that responsibility.”

2) “The WHO is fear mongering. Maybe it is good health politics, people are scared of alcohol and people will have a better live. Maybe it would be better to communicate the risks more quantitavily. Not everyone is stupid.”

3) “The thinking is backwards on this. They state there is no scientific safe drinking level. They even compare it to radiation. The goal is to establish an unsafe level. it's like saying there is no safe speed to drive a car - sure that's technically true, but worthless to say.”

I think it’s just emotional reasoning and HN having a classic case of being critical when presented with evidence that contradicts your pre-existing beliefs while being uncritical of evidence that confirms them.

This was the social network that was supposed to support ActivityPub, right? So… maybe logged out support will be good? I’m still not holding my breath though.

Honestly, sometimes I question how much this site is really “hackers”.

I downloaded the SDK and gave it a try. It was pretty seamless to get the sim booted up. However I did have trouble getting any of my hobby apps to build for the native SDK. A lot of libraries will need to add target conditionals to build natively. I finally got one of my most simple apps running, and SwiftUI does translate pretty well into it, but there’s still a bit of visual jank that I guess I could probably learn how to fix. The simulator also does seem kind of slow and unresponsive; I wonder if that’s at all representative of the final OS.

Basically. I think Elon is a blowhard idiot who succeeds despite himself and have thought so since 2017.

But I purchased my Model 3 in 2021 because, after cross-shopping many car models and trying to optimize for the characteristics and features I wanted, it was the best thing at its price-point. And even now, even after the Twitter debacle, I still enjoy driving it every day. I couldn’t care less about the man who made the car; the product won on its merits.

As a long time Mac user, I had long been used to people saying things along the lines of “I tolerate their hardware to use macOS” especially re: the terrible laptop designs.

Now with the release of the AS machines, I hear the exact opposite sentiment very frequently, especially on techie sites. It’s certainly been an interesting reversal. I for one like both macOS and the AS hardware, and (minus the somewhat higher bugginess with recent releases) couldn’t be happier about the state of Macs.

For more Psybient in the vein of Solar Fields, it's also worth checking out releases on Ultimae Records (which is the label for some Solar Fields releases). Some of their artists which go well for programming IMO are Scann-Tec, MIKTEK, and Aes Dana.

This is a really bad take.

Heat pumps can have coefficients of performance (joules of cooling provided over joules of energy consumed) between 2.5-5 (going down as outside temperatures drop).

In most situations, it’s more efficient to burn the gas for electricity and then put it into a heat pump than to burn it directly for heating.

In the very coldest situations, where the heat pump less effective, then you may use the resistive heating to augment it.

And “green” tech is about changing power generation sources so that, even if you have some more inefficiency, it’s not polluting the planet or running down finite resources as much.

Is C++ Doomed? 4 years ago

I can’t believe I had to come down this far to see the Law of Headlines. C++ isn’t going anywhere for a long time. For all of its technical and design faults and overbearing complexity, its (yes, deceptive) compatibility with C, the most important language in the industry, even at the source level is unmatched and it’s the only language that even competes in the space that it’s in: a language with all the power of classical OOP, which is the paradigm of the industry (hated or not), with the performance of C. It has many different implementations to run on pretty much any computer you could want to run code on. Its compilers are industrial strength and best-in-class and it has wide tooling support. There is a broad talent pool to draw from for hiring.

Rust is the only thing that even looks close to a competitor, but it still has a long road before it’s viably a replacement, and its lack of OOP and strict ownership rules may prove to be too foreign for the vast majority of programmers who are used to slinging pointers around and OOP design patterns, not to mention the cozy C syntax.

Even if C++’s technical merits are lacking, it won a cultural victory by catering to both the hegemony of OOP and C.

Is C++ Doomed? 4 years ago

Perhaps syntactically C++‘s operator overloading can make it quite palatable, but C and C++’s unique aliasing rules would mean that a naive implementation could leave performance on the table. There’s a reason it’s almost always Fortran at the bottom of the stack in most LinAlg codes in most languages.

Is C++ Doomed? 4 years ago

I only have limited experience, but I’ve seen projects migrate from Ada to C++ more often than the other way around. If I had to guess why, it’s probably because it’s easier to hire for.

The biggest loss will be the interesting subreddits like that one. Reddit killed off forums and became the empire that has had its dominion over most of the niche interests. Unfortunately, as Reddit has been growing bigger and bigger and tries harder to cater to the lowest common denominator, the rot seems to be trickling down to even the niche subs. For programming and the like, there’s HN. But for much of anything else, the alternatives are long dead.

The real question is not whether Reddit is rotting, but of where to go after it?

I have increasingly noticed this general trend (here, on Reddit, and elsewhere) to just blame a myriad of societal ills on “Capitalism”. Sometimes it’s related to economics or whatever, but more often it’s really a non-sequitur. Some of the problems blamed on Capitalism, it’s not at all clear how communism or socialism or any other system would result in a different outcome. It’s become a thought-ending cliche.

Pithy, but I’d actually argue the opposite. As someone who consumes quite a bit of science content on YouTube, it’s actually quite jarring to go back to traditional TV science shows. It feels a lot less information dense and more time-wasting.

An interesting example is when Veritasium, who normally does the usual YouTube science content, got some big budget funding for one video [1] and produced it in a style more like what you’d see on TV. It was striking how there was so much filler and dramatization to try to make it interesting, and the whole thing felt dumbed down compared to his usual content, for example [2], which is deeper and relatively information-dense.

And there are channels like PBS Spacetime which go far, far beyond anything I’ve ever seen in any media aimed at a general audience [3].

[1] https://youtu.be/YMDJA4UvXLA

[2] https://youtu.be/OxGsU8oIWjY

[3] https://youtu.be/gSKzgpt4HBU

I think any argument against the possibility of developing AGI is going to have it. The argument has to be either:

1) there’s something non-material about human intelligence (basically, there’s a soul), or 2) something about the processes that created a completely material human intelligence is impossible in principle to reproduce, either implicitly or explicitly.

(1) has the obvious religious angle, but (2) tends to be what’s trotted out when (1) is too overly religious.

With (2), the usual supporting reason is that the conditions are too complex. The problem is that the fundamental rules are just those of physics, which are “simple”. And we have to remember that the initial conditions of the universe were also “simple” and not intelligently set up in a way that could be predicted to create intelligence. It was just a bunch of initially formless matter evolving over time.

By closing the door on even implicit use of physics (which created our own intelligence), which we don’t know enough to rule out completely, there’s the feeling that there’s some kind of magic dust that has to be part of the process or the initial conditions. That would disagree with our current understanding of the laws of physics and early development of the universe.

Ultimately, the real motivation is the desire to maintain the feeling that humans are somehow “special” in the universe.

Microsoft Loop 5 years ago

If Teams is any indication, do you really think Loop is going to be much better?

I think it's fair to say that HN can be a bit myopic. Both about this and other topics, there is a lack of understanding of the mindset of "the general population".

There can be a lot of ideas that a stated in way that makes it seem like most people would totally agree, like that "socializing at the office is obviously a chore that's a waste of time", that "work is about maximizing your programming output", or that "managers want employees back at the office is because they feel insecure about their value and don't trust their employees to get work done". But I don't think the vast majority of the workforce would necessarily agree to those ideas. As much as HN types like to make fun of MBAs and their bean-counting, there's the feeling that in their own heads the primary directive is to try to maximize the throughput of neatly parceled work units and would deride those who disagree as "time wasters".

The risk with this kind of thinking is that you end up not being nearly as objective as you think you are, and worse, you will fail to predict how things are going to happen. If you were reading Reddit during the 2016 and 2020 democratic primary; you would have been sure that Bernie was going to be the nominee. My workplace surveyed whether people want to do full-remote, hybrid, or full-office. Reading HN, you'd think the obvious top choice would have been full-remote, since most of us could actually work fully remote. As it turns out, it was not the winner. (Before saying that management fudged the numbers: The outcome was supported by my informal questioning of my coworkers as to how they voted.)

I recently landed a new job. I'm currently in the process of leaving my old job and awaiting my first day at the new one.

And I think this played into it. I was pretty happy with my old position, but I did have some small desire to find something new. What always kept me back was the fact that I liked the people I worked with.

But as WFH has sort of dragged on, I found that the social bonds have become a much weaker glue for me and there's a minor burnout coming from how stale it is working from home. The camaraderie that kept me at my job sort of faded away. The monotony and increasing apathy toward the people I was working with really pushed me hard into wanting some kind of change, and so almost on a whim I applied for a job at a company that I've been itching to work for. And I got it!

So I'm excited about my new job. I think it'll be more impactful and interesting work where I'm going to get to grow my skills a lot. And my compensation will be doubled. I should be happy that the circumstances forced the change, but I'm also a little uncomfortable with the feeling that it was an impulsive decision due to a mental state that has been caused by temporary circumstances.