HNHacker News
TopNewBestAskShowJobs

yccs27

1,217 karma · joined November 21, 2020

submissionscomments
yccs27··on Inverse Parentheses
Thanks, writing it as 1+2(*)3 made it click for me.

Reminds me of the '$' operator in Haskell - it lowers the precedence of function application, basically being an opening parenthesis that's implicitly closed at the end of the line.

yccs27··on Thoughts on Go vs. Rust vs. Zig
No. There is a global allocator which is used by default, but all the stdlib functions that allocate memory have a version which allows you to pass in a custom allocator. These functions are still "unstable" though, so they can currently only be used with development builds of the compiler.
yccs27··on Ruby Symbols
The article is a bit confusing, but I like the concept behind symbols: Basically a way to distinguish identifier names (chosen by the programmer) from user-facing strings.

The distinction between is one I've mentally adopted in other languages like Python as well. For personal projects I like to use single quotes for 'symbols' and double quotes for "strings", e.g.:

    add_label(text="Hello World!", align='center')
Does anyone else do something similar?
yccs27··on /dev/null is an ACID compliant database
> 85,66% guaranteed uptime (we need some sleep, too)
yccs27··on Knocker, a knock based access control system for your homelab
Unfortunately there's an increasing number of home internet connections behind CGNat, as IPv4 adresses run out (and IPv6 doesn't gain momentum, heaven knows why)
yccs27··on Most expensive laptops
#9 on the list is a Macbook Pro.
yccs27··on Most expensive laptops
Are there any laptops that actually have a desktop GPU built in?
yccs27··on The Weird Concept of Branchless Programming
The most general approach is to calculate all the different cases, and then do a branchless selection:

    var4 = (var1==1)*(var2+var3) | (var1==2)*(var2-var3) | ...
Of course this is basically the slowest possible option, but it might work as a starting point for a general-purpose optimizer to find a faster solution. If it doesn't, this will likely compile to conditional move instructions.

It might help if you replace the comparison and multiplication with an equivalent expression made from bitwise operations, but I believe most compilers already know how to do this transformation.

yccs27··on Effect Systems vs. Print Debugging: A Pragmatic Solution
I was referring to the specific Debug effect described in the post, which only works in debugging builds. This means that the production build cannot have unexpected output from a function with no declared effect.
yccs27··on Effect Systems vs. Print Debugging: A Pragmatic Solution
> Thus you might design a module that has implicit Logger and Database effects in all its functions.

Logging does seem like a very similar case to debugging, only that you expect to leave it on in production. On the other hand an implicit Database effect kind of defeat the point of an effect system.

I think the key is that Debug and Logger effects don't really affect the rest of the code - if you remove all debug/log statements, the only thing that changes is the debug/log output (and slightly faster execution probably).

yccs27··on Why haven't local-first apps become popular?
In other words, Google sacrifices availability/latency here - they don't accept the request until they can be sure it's still available.
yccs27··on A Technical Update on Submarine Cables [pdf]
It varies too much to be useful for powering repeaters. It also can't sustain enough current to be useful, since the resistance across the entire system is huge.
yccs27··on Formatting code should be unnecessary
My $0.02: Don't throw away a perfectly good mental model because of a compiler ideosyncasy. Just treat it as a special case and use a linter against stuff like char* a, b.

You also don't think about dollars differently than other units, just because the sign goes before the number.

yccs27··on Left to Right Programming
You'd never write that ugly one-liner. Just write the recipe imperatively:

    dough = mix(flour, water, sugar, butter)
    dough.knead()
    dough = dough.add(eggs)
    cookies = dough.divide(12)
    cookies = bake(temp=450, minutes=12)
Might be more verbose, but definitely readable.
yccs27··on Hyundai wants loniq 5 customers to pay for cybersecurity patch in baffling move
Not even a marketing cost, a delayed engineering cost to fix a fault in the product.
yccs27··on Constrained languages are easier to optimize
TFA only talks about having strong or weak static guarantees. There's more that typically comes with a "high-level" language like Java: Nonzero-cost abstractions like boxed objects, automatic memory management and more.
yccs27··on A Rust shaped hole
> Memory management was indeed the sore sticking point, why Rust hadn't appealed to me earlier.

The author doesn't want manual memory management, but still decides to go with Rust.

yccs27··on # [derive(Clone)] Is Broken
I can understand why Rust didn't implement an IO monad (even though I'd love it), but linear types seem like they would fit right in with the rest of Rust. Not sure why they didn't include them.

There's actually two different ways that Rust types can always be discarded: mem::forget and mem::drop. Making mem::forget unsafe for some types would be very useful, but difficult to implement without breaking existing code [1].

Btw, you are correct with linear types - Affine types allow discarding (like Rust already does).

[1] https://without.boats/blog/changing-the-rules-of-rust/

yccs27··on Procolored printer drivers contained malware
Yup, that clickbait headline should be "Procolored served customers malware for months, dismissed it as false positives" instead.
yccs27··on How refrigeration changed our food
Home refrigeration is quite a bit older than electric refrigerators though. Iceboxes, kept cool by chunks of ice, were also called refrigerators and started being produced for home use in the 1840s.
yccs27··on Zig's new LinkedList API (it's time to learn fieldParentPtr)
You could create a comptime function that adds the Node field to any type. I guess then you've arrived back at the previous generic version.
yccs27··on Bicycle riders' knowledge and experience of structural weakness in bicycles
I had two close calls: One time my down tube developed a large crack, starting from a faulty weld to to the head tube. Luckily, the lost stiffness made the bike start wobbling so much that I got off to inspect it. On the replacement bike, they didn't tighten the Hollowtech crank arm enough, so it slowly slid off over a few months and finally fell off. I'm glad that I was away from traffic and in my saddle at the moment it happened, so I could just walk the rest of the way home and put the arm back onto the crankshaft.
yccs27··on Sync Engines Are the Future
For me the main issue with CRDTs is that they have a fixed merge algorithm baked in - if you want to change how conflicts get resolved, you have to change the whole data structure.
yccs27··on When Corporate Branding Goes Wrong
When done right, "chasing fads" can be a means towards delivering value to shareholders.
yccs27··on Anime fans stumbled upon a mathematical proof
Let's try them all and see which order is the best.
yccs27··on Does X cause Y? An in-depth evidence review (2021)
If I understand it correctly, they randomly decided to try starting the car immediately or to go wrap the wires first. This absolutely demonstrates a causality, they just didn't cleanly separate the different factors which changed.

Your comparison to placebo is very apt: Giving medication to a patient (vs not giving anything) causes them to get better, but it might be the "giving a pill" part instead of the "ingesting medication" part that matters.

yccs27··on A drill bit that can also drive screws
I think it's not supposed to be a pilot hole, but a hole to put a partially-threaded screw through.
yccs27··on Garmin's –$40B Pivot
Yeah, from the title I thought they lost $40B in market cap due to the pivot.
yccs27··on Why the weak nuclear force is short range
This is it. Typically in a QFT lecture, you'd include a "mass term" (in the article: stiffness term) in your field equations, and later show that it indeed gives mass to the excitations of this field (i.e. particles). So you temporarily have two definitions of "mass" and later show that they agree.

For this discussion it makes sense call the "mass" of a field "stiffness" instead, since it's not known a priori that it corresponds to particle mass.

yccs27··on Derivatives don't always act like fractions (2021)
This is the crucial insight. The last proof in TFA writes it in differential form notation, where "dx at constant y" is dx∧dy = -dy∧dx.
← PreviousPage 2 of 14Next →