18,725 karma · joined Sep 12, 2011 (15y ago) · 4,843 submissions
comment 1w ago · link · parent
And we already have header-only libraries, which are often close enough.
comment 1w ago · link · parent
But there are times when I really want to come to Rust from the other direction, and almost think of it as a Haskell alternative that doesn’t bring all the headaches that come from being lazy. The examples the author chose beautifully illustrate some of Rust’s virtues that lend themselves to that perspective.
(But no, we are not going to talk about higher programming. I did say “almost”.)
comment 1w ago · link · parent
Spoken languages have the odd idiom that doesn’t translate well, and certain languages express certain ideas more or less succinctly. But it’s not like Chinese’s lack of verb tense makes it harder to think about how things are happening in time. The concept still exists, it’s just expressed differently. But not so differently that I can’t translate decently well on the fly.
Programming languages have much more variability in what kinds of concepts they can easily express. In Smalltalk I’m going to use dynamic dispatch to express damn near everything because it’s just about the only sane way to do domain modeling. In Standard ML I’m going to lean instead on algebraic data types and pattern matching. Those tend to lead to very different ways of breaking down a problem. In Scheme I don’t have either built in but both are easy enough to implement as a library, so I’ll freely choose whichever option seems most appropriate to the problem at hand. In assembly language I’ll avoid any such abstraction altogether because, while I could probably implement versions of both, it would be a total PITA and probably result in incomprehensible code. And translating among any of them is likely to be the work of multiple hours or even days.
comment 1w ago · link · parent
The last time I needed C’s power to fit something into memory and compute limitations, it was code running on a microcontroller and better systems languages like Zig and Rust weren’t a thing yet.
comment 1w ago · link · parent
There are even more valid cases where “this integer is not set” and “this integer is set to 0” are different things.
It’s also a type safety concern. Using sentinel values is comparable to the “billion dollar mistake” version of nulls because it creates a special value that implicitly exists and is not part of the variable’s type definition. This means the compiler can’t help you remember to check it. You have to just remember, and forgetting is a bug. With optionals (including opt-in nullability like in Kotlin), on the other hand, the compiler knows when you do and do not have to worry about a value not being present, and can raise a compile time type error when you forget.
comment 1w ago · link · parent
comment 1w ago · link · parent
comment 1w ago · link · parent
As it is, Starship is proving to be a fairly straightforward example of a project that’s stuck in development hell due to excessive managerial meddling and unrealistic expectations.
It’s only getting this much goodwill because SpaceX also produced Falcon 9, which famously also needed 14 flights to safely reach orbit, and definitely did not get there on the first try and deliver cargo to the ISS by flight 4. /s
comment 1w ago · link · parent
And that was just a goal; if they actually pull it off it would be a historic first for rocketry. So let’s estimate maybe 5-10x cost reduction. Hard to know where it would fall in that band while they’re still tweaking the design. But since they made that claim Raptor’s performance has come down by quite a bit and the vehicle’s dry mass has gone up, so they’re certainly not on track to exceed it.
comment 1w ago · link · parent
But that’s also why I’m skeptical about whether Starship will live up to the hype. The whole case for how it’s supposed to revolutionize spaceflight rests on the assumption that it can tap into a huge well of latent demand to put stuff in orbit. If such a well really does exist then we have to ask why Falcon 9 wasn’t able to tap into it despite all of its obvious merits.
comment 1w ago · link · parent
I have yet to be convinced that Starship’s payload capacity is actually a good thing, from a big picture perspective. It looks to me like a possible case of shouting, “I meant to do that!” after a pratfall. On a months-long trip to Mars, you need a vehicle that big for the sake of the human occupants. For launching Starlink, it’s less clear whether the ability to deploy so many satellites at once was worth the vehicle’s development costs. Perhaps it’s just inherited from an earlier iteration of the program that had different goals, and a more modest design would have been more economical. Worse, so far it seems like Starlink might be it. Most other use cases people have proposed for putting 40 tonnes in orbit on a regular cadence are the kind of highly speculative grasping at straws that accompanies any technically impressive solution in search of a problem.
comment 1w ago · link · parent
That certainly doesn’t mean it will never happen or that it’s not worth trying. But I’ve noticed that in these online discussions there’s a tendency to treat moonshot programs as if they’re sure bets.
Also don’t forget social factors. The US had been actively working on establishing more of a presence on the moon, too. But the current administration more-or-less killed it because they didn’t like how much it was costing.
comment 1w ago · link · parent
Raptor isn’t shaping up to be a sufficiently reliable engine. They are still having shutdowns and failures on every flight. That could be a huge problem for cheap and rapid reuse because it implies that quite a lot of inspection and refurbishment will be needed for every engine they re-fly. This was famously a major impediment to cheap reusability for the RS-25 and Shuttle, and they only had to worry about three of those per flight. Starship has 13 times as many engines to worry about, and those engines have thus far had a much higher failure rate.
And then they’ve also been having trouble with the thermal protection system, which seems to require a lot more refurbishment than what they had originally wanted. There have also been some kinks to work out in terms of its actual protection of the vehicle, which is a problem because even minor materials degradation due to thermal stress will limit the reusability of the upper stage.
comment 1w ago · link · parent
But what happens if there isn’t actually that much pent-up, latent demand for flinging heavy things into orbit? What happens if people still mostly want to launch the same size stuff they already do? Starship could become the paratransit shuttle of space: inexpensive, yes, but also inconvenient because of having to share the ride with so many other people that all have different destinations and schedules. In that case we might see that demand for Starship remains low due to potential customers deciding the extra cost of a different option is worth the added convenience. Anyone who’s chosen an Uber even though the city bus can get them to their destination for 1/10 the price should be familiar with the principle.
comment 1w ago · link · parent
I know that is what was promised, but I do wonder how many of Starship’s design goals the program needs to miss on before the general public starts to wonder if maybe goals are not the same thing as guarantees.
comment 1w ago · link · parent
The “10x” developers I’ve known (and been) were all incredibly effective at snagging the work that they personally were most able to do quickly, and shirking the rest.
That’s not necessarily all the difference. But I’d estimate they would maybe be at most 2x developers if you remove their ability to avoid the proverbial 10% of the work that takes 90% of the effort.
AI coding intensifies this effect. And it also helps explain why people’s amazing success stories for personal projects don’t seem to translate to business ROI. For a side project I am in complete control over design and scope, have no customers or stakeholders to keep happy, etc. So I easily - and mostly unconsciously - tailor what I’m doing to what the coding agent can do well, and quietly drop the rest. I don’t have that luxury at work.
comment 1w ago · link · parent
The point is, it’s a tradeoff. With overloading, exactly which code executes on a specific line becomes a bit more implicit because it depends on extra information from the surrounding context: the types of the arguments.
That comes with the usual tradeoffs. On the one hand, you could argue that the compiler is taking care of it for you, which saves the programmer from having to manually deal with it, and removes some visual clutter from the code.
But you can also argue that letting the choice of function be implicit means that a programmer who wants/needs to keep track of exactly what every line of code is doing needs to carry all that contextual information in their own head, too. For this programmer, it’s adding to the mental burden.
I don’t think it’s a coincidence that Kelley constantly brings up how Zig was inspired by difficulties writing a digital audio workstation with very hard real-time requirements. Part of what he’s doing there is giving a motivating case for why he wants to be an absolute control freak about, e.g., micro-managing exactly when memory is allocated and deallocated. That’s something only a subset of systems programmers need, because not all systems programming is dealing with things like hard real-time.
comment 1w ago · link · parent
Suppose, also, that they have decided to make the change incrementally. So a rewrite is not in the cards.
The advantage of sticking with C that I see is that nobody has to learn a new language, migrate to a new toolchain, anything like that. So it is definitely the smaller change. But the downside is that it may be more difficult to hold the line. For some indeterminate (possibly indefinite) period of time you have a mix of legacy code that's being allowed to stay on the old conventions, and new/migrated code that's supposed to be held to the new conventions. IME one solo developer can maintain that distinction, but a team working in a business environment, possibly with people cycling on and off, will struggle with it. You can try to bake the distinction into your tooling, but that's often easier said than done. Most tools expect one set of conventions per project.
The advantage of adopting Zig that I see is that you set a clear demarcation line. New files will be written in Zig. Migrated code gets ported to Zig. Everyone knows that Zig has one coding standard, C has another coding standard. They look different, so it's easy to keep track of which is which. They each have their own compiler flags and static analysis tools, so it's hopefully easier to separate the legacy rules from the new ones.
Now, I mostly do cruddy business applications so I haven't actually done this with C and Zig. But I have done it on the JVM, and IME whether "modernize legacy Java in place" or "modernize legacy Java by strangler vining over to Kotlin" works better depends heavily on what the legacy code in question actually looks like and how much you want to change.
comment 1w ago · link · parent
For a somewhat different example of the same general idea, look at how Java handles primitives and their boxed counterparts. = on two ints always compares their value. = on two Integers compares their pointers. But it uses flyweight instances for values up to 256, so in Java, whether two Integers with the same numeric value are equal according to the = operator depends on what that value is.
Then throw autoboxing and generics into the mix, and it suddenly becomes very easy to do refactorings that work fine in the unit tests (which tend to use small numbers) but fails in confusing ways in production.
This isn’t an example of operator overloading, of course. But I hope it more simply illustrates why, at least in certain problem domains, there’s value in being able to visually tell when surprising runtime shenanigans are and are not possible. And also to make it impossible to cross that boundary without touching all code that falls within the blast radius of that change.
comment 1w ago · link · parent
https://blog.codinghorror.com/falling-into-the-pit-of-succes...