Hacker News new | past | comments | ask | show | jobs | submit | rtlfe's comments login

Using types that encode the units, as suggested in OP, is strictly better.


You're both right, but not all languages give you the choice. And a lot of types are implemented badly. For example as a subclass of a number class, so that `amountDollars + timeSeconds` and other nonsensical statements aren't errors.


I'm not optimistic on unit types myself. I've found that unit-named variables often with transparent type aliases as documentation (type Sample = usize, type Amplitude = i16/f32) have many of the advantages of distinct units, without their downsides compared to bare numbers. In several projects where I've used naming and transparent aliases comprehensively, I don't recall ever letting a unit mistake escape from my local tree into master, since I reread my own code when committing and merging. In one case (https://gitlab.com/exotracker/exotracker-cpp/-/blob/dev/src/... used to have two EXPLICIT_TYPEDEF) I did add distinct units because I found I was mixing together two types too often during development. Though I find that unit types come with significant disadvantages (ergonomic and semantic flaws), making them far from strictly better than bare numbers (much like Rust is far from strictly better than C/C++/Zig):

- You need an implicit conversion to eg. size_t, otherwise you can't pass (smp: Sample) into array indexing like (amplitudes[smp]) or data slicing, without an extra conversion or accessing the underlying value like (smp.v). But you can't allow (smp += midi_pitch) to convert both arguments to int, then cast the result to Sample when assigning.

- You need some conversion to allow (smp + 1) with type either integer (convertible to Sample) or Sample, unless you want to annotate all arithmetic with boilerplate like (smp + (Sample)1), or (smp.v + 1). I've experienced this problem in my own code, and had to write (smp.v) when my compiler saw (smp + 1) and told me it didn't know whether to wrap 1 or unwrap smp.

- Expressions of type Amplitude * 2 should have type Amplitude. Go's time library gets this wrong, where multiplying Duration * Duration = Duration, which makes sense if Duration is an integer like i32 or i64, but not if Duration is a unit system dimension.

- (not a regression but a limitation) Units won't stop you from adding two temperatures in Celsius. To fix this you need separate coordinate and displacement types, which is a new pile of complexity.

- You may want distinct types for "samples/sec" and "cycles/sec". Modeling this in type systems has multiple current approaches, all of which rely on language support (F#) or complex type machinery I've had issues with.

- You can't easily convert between slices of f32 (like an audio buffer provided by the OS), and slices of Amplitude<f32>. Or worse yet vectors of f32 and Amplitude<f32>. (This problem affects bulk data in collections, more than scalar types generally passed and returned in the stack.)


If you're the type of moron who will write:

  chargeCustomer(amountDollars: valueInCents)
I have little faith that types would help you. You could simply do:

  chargeCustomer(amount: Dollars.from_int(valueInCents))
And create the same bug.

Positional arguments is just as big an evil as non-typed units, IMO.


> anything you buy for $5 in a supermarket is neither rare nor luxurious

When it's sitting next to a $0.89 box of Kraft macaroni, the $5.00 box definitely feels like a luxury.


> Thank you for continuing to adhere to Twitter policies that prohibit you from discussing confidential company information on social media, with the press or elsewhere.

Ha.


> Twitter said in the email that its offices will be temporarily closed and all badge access will be suspended in order "to help ensure the safety of each employee as well as Twitter systems and customer data."

Is this normal during mass layoffs?


I have seen investment banks disable all logins for a whole division or trading floor, invite the people they aren’t firing to an all hands / town hall meeting to tell them as much, then announce to everyone else on the floor that they no longer have a job and will be escorted out of the building with any belongings they choose to collect within 30 minutes.

I’m not sure how normal it is, but it doesn’t objectively seem like there’s anything wrong with it.


There's an outdoor area on the top (11th) floor of our building - the door is always locked during restructures.


Ooooh that is dark. Must have been fun for the smokers who have been around for a while. Having worked at a company that went through a few years of trouble, there were all sorts of little signals like that you'd learn to pick up on.


There's an episode of "Succession" that captures this vibe pretty well.


There's a scene in the movie "Margin Call" (about the 2007-2008 financial crisis) in which most of a floor of employees in an investment bank is laid off: https://www.youtube.com/watch?v=zn2Xf9hAFcE


Seems very unusual to suspend all employees badge access, given "Some employees have been ordered to work in the office every day of the week to meet the deadline" per this article: https://www.reuters.com/technology/musk-orders-twitter-cut-i...


You only need the badge to get in. Makes perfect sense.


> Is this normal during mass layoffs?

Yes, and for good reason.

A company I was familiar with in the 80's had a subsidiary in another state with a couple hundred employees. They decided to close that office, and lay everyone off.

Being nice guys, they gave the branch 3 months notice of the closure and layoffs, and expected them to keep working as usual.

After 3 months, the parent company officials arrived to find the office building empty and looted clean.


It’s unusual for a new owner to lay off 50% of a company at once


Nothing that is going on at Twitter is "normal"


Imagine being on the team that's clearing out everybody's desks. Once that's done, you're no longer needed. But hurry up, now.


That work is probably contracted.


> Also, are the wells well curved/deep

The keyboard is flat, but the caps are sculpted


For me, the most important thing by far is to not have to extend my pinkies to another column. A good thumb cluster and mod-tap implementation dwarf any of what you listed for my needs.


If the link in this comment is accurate, part of it could be that Americans eat terrible food. https://news.ycombinator.com/item?id=33297849


I'm not American, but I doubt I would have gotten MS were it not for terrible diet, stress, lack of sleep, various deficiencies at the time of diagnosis but also during childhood. Also had a very bad bout of mononucleosis when I was 10 (while also being malnourished), so these things can go quite far. So I think my nervous and immune systems were always frail.


So sorry to hear. As of 2022 there is enough evidence for a causal link between EBV (the virus that also is behind mononucleosis) and MS later in life. The hope is that humanity will eventually have strong drugs and maybe a vaccine. Unfortunately, progress has been very slow until now. I hope things will move faster now that people could convincingly argue about this link between a virus and the disease.


> Can enter any building? Can I make a hole in the ground? Can I cut trees? Can I kiss NPCs? Can I demolish any building?

I'd really prefer for the developer to focus on the gameplay and plot rather than make a perfect simulation of earth. What you describe sounds like a cool sandbox, like Flight Simulator, but isn't appropriate for most games.


> never use profanity (even saying 'crap' was very infrequent)

Why does this matter?


From my experience they learn from the older kids as soon as they start school. At least in my culture. My daughter came home saying "shit what the fuck" (in English, despite English not being the native tongue of the locality) one day. And now she will curse like a pirate when she hurts herself. But she already knows they are words that people attach special meaning to: she avoids them when "not needed", for example. Except when she wants a reaction, which she never gets from me at least.

We don't use many such strong words ourselves, but like with many things she learned on her own in the cultural melting pot that is public school.


Just my own observation, but all the kids I remember that cursed a lot weren't very good at English. Not sure if it is correlation or causation, but who needs to find the right word to express yourself, when "fuck" or "shit" almost certainly fit the bill?

Maybe people who curse poetically are even better at English than non-cursers, but that probably comes with age and isn't relevant to advice about children.


My anecdata is similar, but rather: the little kids I know who curse a lot and openly, have terrible manners overall. Talking nasty to grownups (and other kids), etc.


Our society tends to reward people that curse infrequently?


No it doesn't. It rewards people with the social skills to know when it's acceptable to use certain words that aren't acceptable in other contexts. But that's just a part of 'society rewards people with high levels of social skills'. If your experience has been that successful people (i.e., 'people who were rewarded by society') don't swear, then your experience has been very different from mine.


I’ve met enough rich people to know that certainly is not true.


I’d say the frequent use of foul language is highly correlated with other modes of anti-social behavior.

At the end of the day rude people are inconsiderate people, if you’re not thinking about how your behavior effects others…


It's more about having self respect. Why use the same language as drunken sailors and criminals?


> Why use the same language as drunken sailors and criminals?

Aside from hate speech, I honestly don't care what kind of language my kid uses. But I'd be pretty disappointed if they reduced groups of people into negative stereotypes like this.


Indeed. Some sailors are amongst the greatest people I've met. And their language was salty.

Language is communication. Context is important. You don't bust into a church or interview swearing loudly. You don't try to communicate every thought with a curse word.

But fuck it, they are handy sometimes.


If this is ironic this is a pretty funny joke, and if this isn't ironic this is even funnier.


Do you want your child growing up to be foul-mouthed?


Who cares? As long as someone can shut it off when needed (e.g. at work) this is something that does not matter at all.


Maybe his point isn't that cursing is bad, but that you should set an example for proper manners. Like, the language they should use when talking with schoolteachers, at work, etc.

That's my household: they'll hear plenty of salt when we play Jay-Z or Run The Jewels around the house, and it's no big deal if they cuss while telling us about their day, but we'd never tell them to "Pick up the fucking dishes."


One of the jobs of parenting is teaching social norms. Children don’t instinctively know them.


When you have 100k+ employees, there's obviously going to be somebody complaining about every decision.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: