HN user

austinz

2,359 karma
Posts54
Comments348
View on HN
article.gmane.org 10y ago

Completing Swift Generics

austinz
22pts1
austinzheng.com 10y ago

Generics in Swift: An Overview

austinz
5pts0
austinzheng.com 10y ago

Generics in Swift: An Overview

austinz
1pts0
www.nytimes.com 11y ago

The Pigeon King and the Ponzi Scheme That Shook Canada

austinz
6pts0
www.nytimes.com 11y ago

How Arizona State Reinvented Free-Throw Distraction

austinz
8pts0
www.nytimes.com 11y ago

Obama Heads to Security Talks Amid Tensions

austinz
6pts0
austinzheng.com 11y ago

Sequences and Generators in Swift

austinz
27pts1
news.ycombinator.com 11y ago

Ask HN: How to get started with PCB design?

austinz
4pts5
www.nytimes.com 11y ago

‘Superbugs’ Kill India’s Babies and Pose an Overseas Threat

austinz
6pts0
github.com 11y ago

Show HN: Clojure-ish Lisp interpreter implemented in Swift

austinz
2pts0
www.nytimes.com 11y ago

North Dakota: Where Oil and Politics Mix

austinz
1pts0
www.theverge.com 11y ago

Starfish are dissolving up and down the West Coast

austinz
75pts58
www.newyorker.com 11y ago

Good Game: The Rise of the Professional Cyber Athlete

austinz
99pts31
groups.google.com 11y ago

Map/filter higher-order functions on [Go] collections?

austinz
3pts0
www.nytimes.com 11y ago

Space Tourism Isn’t Frivolous, or Impossible

austinz
73pts59
www.nytimes.com 11y ago

Unexpected Complexity in a Spider’s Tiny Brain

austinz
13pts0
github.com 11y ago

Show HN: Hakawai, an iOS text view supporting 'mentions'

austinz
3pts0
www.iflscience.com 11y ago

The Very Hungry (Carnivorous) Caterpillars

austinz
2pts0
www.nytimes.com 11y ago

A Tiny Emissary from the Ancient Past

austinz
34pts0
www.bbc.com 11y ago

A tiny group of people can see ‘invisible’ colours that no-one else can perceive

austinz
194pts86
www.nytimes.com 11y ago

Mining for Antibiotics, Right Under Our Noses

austinz
5pts0
www.nytimes.com 11y ago

Silicon Valley Builds Up in Microsoft's Backyard

austinz
5pts0
en.wikipedia.org 12y ago

Nakagin Capsule Tower

austinz
1pts0
patrickmccabemakes.com 12y ago

Connect Four Robot

austinz
1pts0
www.nytimes.com 12y ago

Poor Sanitation in India May Afflict Well-Fed Children With Malnutrition

austinz
5pts0
snarxiv.org 12y ago

ArXiv vs. snarXiv

austinz
2pts0
www.nytimes.com 12y ago

Services Emerge to Help Out-of-State Students Pay In-State Tuition

austinz
2pts0
www.nytimes.com 12y ago

Oversharing in Admissions Essays

austinz
2pts0
www.nytimes.com 12y ago

Japan Seeks to Squelch Its Tiny Cars

austinz
41pts50
github.com 12y ago

Show HN: 2048 in Swift

austinz
92pts34

For someone who laments the failure of modern programmers to learn from the work of the past, the author seems to completely ignore the contributions of ML, ML-style type systems, and related languages to the profession of software engineering. Perhaps this explains the snide (and, frankly, uninformed) dismissal of Swift as a hype-ridden "subset of Lisp".

Aside from that, I agree with the author's points.

I think an interesting life is important. I also think, though, that many people lead far more interesting lives than they realize. Some people are better than others at noticing and extracting the interesting parts of what would otherwise be humdrum everyday tedium.

What a great summary of the utter baseness of this type of advertising: a stomach-turning body horror image I never wanted to see, some article calling strangers "morons" based on some stupid superficiality, and gossip about the private lives of strangers that is, quite frankly, none of my business.

That being said, if these companies vanished tomorrow it wouldn't be a complete positive either, since the fine sociopaths of the advertising industry would simply use the resultant vacuum to come up with something even more contemptible. Fuck that industry.

"Advanced manufacturing requires management and communication skills and the ability to operate complex information-based factories" is meaningless consultant jargon. It would have been better to explain exactly what about advanced manufacturing makes it so special that it requires 'management' and 'communication' skills that the managers and workers in non-advanced factories apparently lack. Meanwhile, "ability to operate complex information-based factories" is almost a tautology. Maybe talk about industrial IOT, or what specialized skills are necessary to efficiently operate a factory full of robots, or _something_?

I've seen interest on the lists for modifying the model to allow a single failure type to be specified. I hope someone will write up a proposal once August rolls around and the lists are open again to new feature ideas.

Scala tries a lot harder than Swift to unify object-oriented and functional programming principles.

For example, in Scala operators are (IIRC) implemented as methods on objects, there's a 'Nothing' bottom type that is used for covariant generic parameterization, and ADTs are implemented using inheritance in the form of case classes.

Swift has no top-level object type or bottom type, and a lot of its more functional style features (ADTs in the form of 'enums', value types that enforce immutability) are completely divorced from the object-oriented part of the language.

That's bizarre.

One thing I've noticed is that performing the string scanning operation is relatively cheap. (If the splitAndTrim code is modified to not use Strings and to return a [String.UTF16View], the runtime is around 1.2 seconds.) It's the process of building Strings out of those UTF16 views that is destroying performance.

I still don't know why changing the way the input data are constructed would have that effect, except to guess that the underlying representation is different somehow. I'll file a ticket.

After a bit more investigation, I found that if you replace the following code:

  result.append(begin == eos ? "" : String(cs[begin..<end.successor()]))
with this:
  if begin == eos {
    result.append("")
  } else if let str = String(cs[begin..<end.successor()]) {
    result.append(str)
  }
runtime goes down from ~3 seconds to ~2.2 seconds.

This is due to a rather insidious API design decision:

  init?(_ view: String.UTF16View)
constructs a string out of a UTF16 view, but it can fail. If used in a context where its type is inferred to be non-nullable, the following generic reflection-related init is used instead:
  init<T>(_ instance: T)
I'm going to bring this up on the list and see if there are better ways of doing things.

As far as I can tell most of the rest of the time is spent in the Swift native Unicode --> UTF16 decoding machinery, and NSCharacterSet.

"This is a proposal and not a plan of record."

Not only that, the git feature branch, if it ever existed, doesn't anymore.

To be clear, that document contains brainstorming by some core Swift team developers. It's neither implemented in Swift nor officially accepted as a guideline for future development.

Regarding strings...

I briefly ran the code sample you graciously provided me with a month ago through the profiler (https://gist.github.com/austinzheng/d6c674780a58cb63832c4df3...).

Long story short, it looks like the reflection machinery in the standard library is improperly being used to construct String instances. Doing so, while probably not sufficient to account for the entirety of the awful performance, is probably quite expensive. This looks like a bug and I'll try to dig deeper into it this week.

Swift also badly needs a native version of NSCharacterSet, even if only for programmer ergonomics.

The developer in charge of the standard library has mentioned that that team intends on redesigning the String API in the near future; this should provide an opportunity to reexamine the performance implications of the current implementations.

OS X app in plain C 10 years ago

VHDL vs Verilog flame wars everywhere. Also, discussions on people's favorite idiosyncratic, vendor-specific dialect of C for embedded devices.

I'm not saying the experiments were trustworthy or conducted properly. Only that the author of the article misunderstood the experimental setup.

(To be precise, the comment about the null thruster was made by the author in a comment on this article, and by a previous article written by the author, which this one references. It is not in the article itself.)

I am skeptical about the EmDrive (although I would very much like it to be real), and my opinion on the drive or its theoretical underpinnings is not really relevant, given my lack of knowledge about the field. But I don't think that writeup is very good either:

From the IO9 article:

The experimental setup is so flawed that it’s continuing to produce measurable “thrust” while in null mode when it should do nothing.

From the Wikipedia page on RF resonant cavity thrusters (and corroborated by the citations):

the 'null test article', was designed without the internal slotting that the Cannae Drive's creator theorised was necessary to produce thrust

The null test device was not intended to be the experimental control.

The article's author seems to fundamentally misunderstand the purpose of the null test setup. Setting everything else aside, if the null articles did produce thrust, this would disprove the Cannae theory (which requires the slotted configuration), but would say nothing about the efficacy of RF thrusters in general.

Their quotes from various physicists about why the drive is probably nonsense are a lot more compelling.

My (highly speculative) guess is that your String issues were due to either/both:

- Swift performance issues involving working with strings, some of which have been ameliorated by later releases;

- 'Hidden' bridging between NSString and String, which can be expensive and might have something to do with some of String's APIs actually being Foundation APIs in disguise.

There is much to be done with regards to Swift performance, though. If you have any sample benchmarks I would be interested in writing/running them myself, just for personal edification.

In terms of 'close to the metal', I freely admit this is a ill-defined term I am using for my own benefit. Swift code doesn't execute on something akin to the JVM or CLR; it still requires a heavier runtime than (e.g.) Rust. It is AOT-compiled to machine code. (But then again, this is possible to some degree for Java as far as I can tell, although it is certainly not the most popular way to run Java code.)

I agree that mandatory RC for classes and boxed types makes Swift impractical for a certain definition of 'systems software' typically written in C++ and occasionally Rust. For a different definition, one that encompasses the garbage-collected Go, Swift is theoretically suitable. The language designer has mentioned that he would personally like to see Swift gain some form of borrowing/lifetimes, although even if that did happen Swift would not get it for years to come.

It's possible to write non-GUI command-line Swift programs that run on Linux (and certain other platforms). In terms of 'close to the metal', Swift is probably much closer to Rust or C++ than C# or Java, and is at least at the same level as Go.

I love C# and think it's a great language, but when it was as old as Swift is now it was widely perceived as a Java clone. In fact, even today C# and Java are much closer in language design philosophy and implementation than C# and Swift, and calling Swift a "C# clone" betrays a profound lack of familiarity with what Swift is or how it works.

Yes, because moving from vtables to message passing eliminates a whole class of semantic errors whose genesis is independent of the implementation details of the language. Thanks for making this clear.

Since I expect nothing less than clear, well-informed commentary from Hacker News regulars, I would be very interested in learning exactly what technical aspects make Rust, Python, and Go superior to Swift in each use case, as well as lessons that future PL designers might draw from the Swift team's missteps.

The difference between traditional and simplified Chinese characters is more than simply different fonts. Part of the difficulty is that some simplified characters map to multiple traditional characters, which means that converting from one to the other may be lossy. There's also the Japanese equivalent of simplified characters (shinjitai), many of which differ from their Chinese counterparts, as well as characters that were invented in Japan and may or may not have Chinese equivalents (kokuji).