Hacker Newsnew | past | comments | ask | show | jobs | submit | jsat's commentslogin

I see an article about how strict typing is better, but what would really be nice here is named parameters. I never want to go back to anonymous parameters.


Why? In 2025 we have tooling available for most every editor that will annotate that information into the display without needing them present in the file. When I autocomplete a function name, all the parameters are there for me to fill in, and annotated into the display afterwards. It seems like an unnecessary step to reify it and force the bytes to be present in the the saved file.


So those editors could just insert the names for you. The bytes in the source file are not a serious concern, are they?


Yes, this is one of the few things that I think was a big mistake in Rust's language design. I used to do a lot of Scala, and really liked named parameters there.

I suppose it could still be added in the future; there are probably several syntax options that would be fully backward-compatible, without even needing a new Rust edition.


I suppose the sense it is backwards incompatible is that library authors have named their parameters without intended to make them part of the public interface that they commit to maintaining. Perhaps it could be made backwards compatible by being opt in function declarations but that would seem like a bit of a pain.


When there are 3-4 parameters it is too much trouble to write the names.


> When there are 3-4 parameters it is too much trouble to write the names.

Sorry, I don't agree.

First, code is read far more often than written. The few seconds it takes to type out the arguments are paid again and again each time you have to read it.

Second, this is one of the few things that autocomplete is really good at.

Third, almost everybody configures their IDE to display the names anyway. So, you might as well put them into the source code so people reading the code without an IDE gain the benefit, too.

Finally, yes, they are redundant. That's the point. If the upstream changes something and renames the argument without changing the type I probably want to review it anyway.


They aren't even necessarily redundant. If you have argument names as part of the function name, they can be overloaded on - and this is much more readable than type-based overloading because it's all explicit. Swift uses this to great effect, e.g. here are some different ways to construct a string:

   String(repeating: "foo", count: 42);

   String(cString: zeroTerminatedBuffer); 

   String(42, radix: 16);

   String(contentsOfFile: "foo.txt", encoding: .utf8);


Oooh. Nice. I forgot about the Smalltalk / ObjC / Swift usage of keywords for messages.


Making something longer doesn’t make it easier to read, especially in repetition.


Making something explicit does.


Would it be better if you wrote out the type of every variable every time you used it? That would be more explicit.


Not OP, but I imagine he's arguing for something like python's optional named arguments.


Had the same thought... It's backwards that any language isn't using named parameters at this point.


Named parameters do come with a large footgun. Renaming your parameters is a breaking change.

Especially if you're coming from different langs.


E.g. OCaml has the ability to separate argument name and variable name for named arguments: let foo ~argument:variable = variable + variable

In fact, I think OCaml has one of the best labeled argument system around there. The only downside is that it doesn't always interact well with currying, but perhaps languages without currying could just copy all the rest.

Just to elaborate a bit, in OCaml you can have functions like:

    let foo ~a ?b c =
      let b = match b with
        | None -> 42
        | Some x -> x
      in a + b + c
And you can then call this like foo ~a:1 ~b:42 55 or foo ~a:2 ?b:None 55. But then forwarding those optional parameters works like:

    let bar ~a ?b c =
      foo ~a ?b c
and the optional parameter b will be forwarded as an optional parameter.

Given Rust's historical relations with OCaml I'm slightly disappointed that it doesn't have the same labeled and optional argument system.


I guess but you're changing your user-visible API so it should be a breaking change. In languages that don't have this type/arity is all that matters and the name is just nice sugar for the implementor who doesn't have to bind them to useful names.

Even if you don't use keyword args your parameter names are still part of your API surface in Python because callers can directly name positional args. Only recently have you been able enforce unnamed positional only args as well as the opposite.


This only really applies to languages that don't check this at compile-time. I don't consider compile-time errors a foot gun. I mean, it should be impossible for that kind of bad code to ever get merged in most reasonable CI/CD processes.


No? This happens in any language that has keyword args.

If I delete/rename a field of a class in any statically checked language, it's going to report a compile error, and it's still a breaking change. Same thing with named arguments.


Sure, but it doesn't actually matter because this can't ever manifest as a bug. Your PR will just be rejected, which to me, is correct behavior.

Typically when you're changing a name you're changing behavior, too. This isn't just something we should let slip under the radar, otherwise bugs can actually manifest.


This is one of those things where it makes people feel very smart to dunk on it, but if you think critically for a minute, the behaviors this enables are already available in objectively more harmful ways: credit cards and payday loans.

This makes things better, not worse.

Obviously people wouldn't be doing this ideally, but that's the world we live in, and this isn't some new phenomenon or some sign of the times.


Have you read the fine print on their website? It’s literally just a credit card/payday loan. The rates if you miss a payment go as high as 33% APR

https://www.klarna.com

Edit: since it might vary by location, here’s what footnote 6 says for me, in part:

> A $1,000 purchase might cost $181.04 per month over 6 months at 28.99% APR.* *Rate ranges from 7.99%-33.99% APR based on creditworthiness and subject to credit approval…


It appears that a simple bit of corporate 'synergy' camouflage has tricked you into thinking this is not a payday loan. Maybe those dunking on it are on to something.


or maybe it'll help highlight how dependent we've become on credit cards meditating almost every financial transaction.

i distinctly remember ~20 years ago a that a friend bought a cup of coffee using a credit card and we all made fun of him for it because we thought he was trying to show off. "credit cards are for emergencies and big things like plane tickets, not a three dollar coffee".

now, i go weeks without having any cash on me.


If you compare to the west coast, it is not rampant. I just moved from Seattle to NYC and the difference is striking to put it mildly.


Fair. I was checking out jobs in LA and was blown away. Was the primary reason I passed on my offers there. Also I didn’t want to give up my public transit


The flip demonstration video needs to be redone. Very poor execution by the person flipping.


Right? It reminds me of those game ads where they intentionally fuck up in an attempt to get you riled up.


If it's too perfect, it would look fake. Perhaps make a first poor run and then another nice run, as if the person learned how to flip in the middle.


True, makes me question the paperstock and dimensions.


If we cared about traffic violence, speeding would be a solved problem. But we don't.


"Traffic violence" implies deliberate acts intended to cause harm, but I don't think that's what you're referring to.


You've never seen aggressively dangerous driving? Must be nice living there.


Sure, but I'm not sure "aggressively dangerous driving" is broadly equivalent to violence, or should be described as such.

At any rate, I'm not attempting to say traffic fatalities and injuries aren't a problem.


In the last few days I've taken a few Waymo's around SF and driven back and forth on I-80.

I-80 is definitely a hotbed of aggressively dangerous driving and the violent use of vehicles against others that aren't driving how you want them to (and I'm a fast driver).

Have those two experiences very much back to back, I joked about how once we get robo-taxis we'll never go back. Human drivers are dangerous enough of the time -- it's not like I've ever driven on I-80 and NOT seen crazy, pants- staining driving. It's every mile or two of the whole stretch.

(Waymo feels so much more mature and pleasant than the last FSD Beta I tested.. Elon should be embarassed.)


I'd argue that the main issue on US highways is a lack of discipline.

US drivers get away with murder in terms of undertaking, tailgating, camping in fast lanes under the speed limit, not to mention driving vehicles that are in such states of disrepair that it's a miracle the drivers get anywhere.

I'm way more relaxed cruising at 160km/h in Europe than literally any stretch of the I-5.


> US drivers get away with murder in terms of undertaking, tailgating, camping in fast lanes under the speed limit, not to mention driving vehicles that are in such states of disrepair that it's a miracle the drivers get anywhere.

Great, so why aren't those things ever candidates for this kind of automated enforcement? Why is it always "speeding"? In addition to the ones you listed, there are so many distractions now, too. Take a ride down any US freeway as a passenger in some kind of elevated vehicle (like a double decker bus) such that you can see down into people's cars: Probably 1/2 or more are totally out of it, distracted zombies scrolling on their phones. Nobody is calling for this to be cracked down on either.

It's always just "speeding". Like if we solve that, we're done.


Speeding is a lot easier to solve than distracted driving. It is pretty trivial to measure it objectively from outside the offending vehicle. Speeding also makes everything else worse due to stopping times and kinetic energy. It is also a black and white thinking fallacy to argue that just because someone promotes one thing that they necessarily demote everything else.


Agree 100%.


> I'd argue that the main issue on US highways is a lack of discipline.

That is a fair point, but unfortunately there is no good solution to that... otherwise we wouldn't need laws and their enforcement in the first place.

It's all about risk... if people are speeding too often and too fast that it's becoming dangerous (which I 1000% agree with), then I think more strict enforcement is warranted.

Conversely, we don't outlaw going outside just because someone could run you over... the risk is not high enough. But I think the risk of injury or death from speeding is very high.


The risk of speeding vs. the risk of staring at your phone. Try doing them for equal times and see what results in a crash…


Apples and oranges my friend.

I am quite confident that most people do not think we should be comparing the risk of speeding to just veering into oncoming traffic, phone or not.


If I go in a crowded night club and start swinging a golf club around, but not at any specific individual, is the end result violence? Was my action violent?

To me it's an extremely clear yes. The only reason I can see why we view this differently is just because we've all agreed this doesn't apply to choices made while driving. But I can't see why that would be the case.


On your first point, that sounds like violence to me, sure. It's almost guaranteed to cause harm, and the club swinger probably knows that.

On your second point, the likelihood that speeding will cause actual harm to another person is vastly lower, and certainly not an outcome expected or intended by drivers generally speaking. Seems silly to call that "violence" when we can just call it irresponsible, negligent, etc.


The risk of pedestrian death in a collision goes from about 10% at 25mph to over 50% at 40mph, and this level of speeding is absolutely normal in the american city I live in.

A pedestrian dying because of a driver's decision to speed in this way is predictable, absolutely expected. Shit I doubt my odds with a golf club at a party are anywhere near 50%. So why is one violence and the other not? I think only because we have decided it is not. But again that decision is exactly what I'm challenging. Calling it silly is not a convincing argument to me.


Those things aren't really equivalent though. The percentage of pedestrian deaths in a collision at given speeds is starting from a 100% rate of incidence. So whilst it's predictable, it's not necessarily probable. How many pedestrians is a driver actually likely to hit driving at 40mph? Generally speaking, zero. How many people is a lunatic swinging golf club likely to hit in a crowded club, quite a lot more than zero.

Nevertheless, I appreciate your point. I was thinking only of speeding on highways. Speeding is an issue and shouldn't be minimised.


Are you implying that solving that problem would also solve speeding? I don't really see the connection.


Of the subset of unintentional crashes it's hard to say how many of them are from irresponsible driving behavior. But I do know that the vast majority of people driving around me on highways/freeways/etc do not obey the speed limit and instead just sort of travel in high speed flocks. Like they don't care that they're operating extremely dangerous vehicles doing an extremely dangerous thing. This is not intent to cause harm but more like playing catch with a loaded firearm.


People driving at the speed of surrounding traffic are not creating a particularly high risk even if their speed exceeds the posted speed limit. People driving at a different speed from surrounding traffic do create an unusual risk, even if that speed is legal and the other drivers are speeding.

This becomes less true in places like Germany where lane discipline is very strict. It's not rare to see extreme speed differentials on unlimited speed sections of German Autobahns, but it is rare to see crashes there.


> People driving at the speed of surrounding traffic are not creating a particularly high risk even if their speed exceeds the posted speed limit.

The whole "everything is fine as long as everyone is doing the same speed" bit is a myth.

For every percent increase in speed, this leads to a 2% change in injury accidents, a 3% change in severe injury accidents and a 4% change in fatal accidents.

https://road-safety.transport.ec.europa.eu/eu-road-safety-po...

More about speed vs injury/death rates:

https://www.iihs.org/news/detail/new-crash-tests-show-modest...

https://safety.fhwa.dot.gov/speedmgt/ref_mats/fhwasa1304/Res...

Why? Kinetic energy is a function of velocity squared, influencing injury severity and stopping distances.


Just to be clear, are you and others in this thread advocating driving the posted 45MPH speed limit on a highway where the actual flow of traffic is going 65MPH? And you don't think that's going to be disruptive to the point of causing accidents?


Just to be clear, are you and others in this thread advocating for driving 20 mph faster than the 45 mph speed limit just because you see other criminals doing the same? That's wildly illegal and would probably get your license revoked.


That's essentially the situation on the highways through Atlanta. It's so extreme that some students made a video[0] demonstrating the extreme effect on traffic when drivers in every lane maintain the speed limit.

Their conclusion is that the speed limit should be increased; there are other reasonable conclusions one might draw, but I would argue against the one that follows from your comment: that nearly every driver on the road deserves punishment.

[0] https://www.youtube.com/watch?v=OoETMCosULQ


Changing the speed limit to the current status quo "speeding" is the reasonable thing, yes. We've already accepted that rate of lives lost at the higher speeds so make it official. Law breaking while driving should not ever be the status quo. It's an absurd situation that one almost has to break the law to drive.

I would be very interested in if people would then go the reasonable new speed limit or if they would continue in their speeding flocks and only travel even faster. To me it seems like their speed is mostly something they evaluate relative to the rest of the drivers and not to absolute speeds so it'd take quite a change in behavior.

As for [0], the traffic back-up proves only that the vast majority of people on that road are speeding.


Maybe there's better research available, but this DOT report found that changing speed limits has fairly little effect on how fast people drive: http://www.ibiblio.org/rdu/sl-irrel.html

My take on it is that when the speed limit doesn't match the 85th percentile speed of actual drivers, something should be changed. Sometimes, (often, in my view) it's the speed limit. Sometimes, it's the design of the road, especially in cases of neighborhood streets that are shaped like highways. Sometimes the answer may be highly-visible traffic cameras, as the advance warning and certainty of punishment will slow down almost every driver.


Illustrating the difference between being a safe responsible driver, and pedantry.


> People driving at a different speed from surrounding traffic do create an unusual risk, even if that speed is legal and the other drivers are speeding

Driving the limit in the right lane is almost always fine.


People who do not drive the speed limit are objectively breaking the law. And generally each flock travels at a different speed. After all, they have no way to communicate a common speed standard like, say, a speed limit.


I agree say this is generally true in the United States, where driving discipline on highways is basically non-existent. Although I would stop short of calling it "extremely dangerous".


How many people would need to die each year for it to be considered extremely dangerous? Literal wars have been started over fewer deaths than the US road network racks up in a year. OK I’m being facetious but the extent to which we’ve normalised 40,000+ deaths a year really is remarkable, can you imagine the reaction if smart phones killed that many?


Sure, it's problem.

But speeding-related fatalities accounted for 30% of traffic fatalities in the US for 2022. Which implies there are plenty of other issues, such that I think saying "speeding is violence" doesn't really do anything to address the problem.


Roadway injuries and deaths are both leading causes for many demographics and the US has a death rate three times Canada's, per capita. More than 4x the UK's.

I'd call that extremely dangerous...


And 70% of those deaths are not considering "speeding-related"[1].

Focussing on speeding seems to ignore that there are other serious issues that contribute to the outsized danger on US roads.

[1] https://injuryfacts.nsc.org/motor-vehicle/motor-vehicle-safe...



> "Traffic violence" implies deliberate acts intended to cause harm

Not really. The violence of traffic crashes increases as the speed increases.


Without devolving into a discussion of semantics too much, violence really does imply some intent to harm another person, or people.

If I drive at ~200km/h on my way from Berlin to Munich, am I "being violent"?


> violence really does imply some intent to harm another person, or people.

That is one of the meanings/senses of the word, but not the only one.

It is perfectly reasonable to say that driving ~200km/h is a violent speed without saying the the driver is being violent because those are two different senses of the word.


> violence of traffic crashes

Within an individual human context, violence usually requires intent.


> Within an individual human context, violence usually requires intent.

There is a sense of the word that implies intent, but that is only one of the senses and another sense that means "forceful or strong" is often used in describing traits of individual humans and their behavior emotions. A violent nod is not a nod intended to cause harm. The violence of someone's emotions refers to their strength, not their intent.


>If we cared about traffic violence

The trend of "slapping a 'violence' label after anything vaguely harmful but not actually violent" is so tiresome.


Look up the most common causes of death in America and come back


Please. The amount of sensationalization here is beneath HN. This is average which we all know is incredibly skewed towards high net worth individuals. The median (much more representative of the "standard" qualifier) net worth of an American household is far, far lower.


"The average depth of this lake is 2 feet" --Said the wading man moments before his drowning death in a 20 foot deep hole.


As per the article, median net worth is $192,900.


That's a lot higher than I would've thought.

I wonder if negative net worth is included in the mean and median calculations, or if it's clamped to 0.


You don’t need to clamp for the median (unless you mean to exclude them from the dataset entirely, which is almost surely not done).


Headlines like this are to keep the masses who are far far below the $1M mark pushing hard to finally* make it.

* A carrot they'll never get by hard work alone.


Today's music generation is putting my Pop Ballad Generator to shame: http://jsat.io/blog/2015/03/26/pop-ballad-generator/


That first paragraph nearly made me spit my coffee. Self-parody even if you believe in crypto.


IMO the "vastly superior" comment here hurts the credo of your argument.


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

Search: