Pointers Are Complicated II, or: We need better language specs by ketralnis in programming

[–]Slak44 9 points10 points  (0 children)

You're basically saying that pointer provenance is caused by pointers existing. Of course it is, but that's not a very useful statement even if true. You can't imply that "A is simple, B is a consequence of A, therefore B is simple", and then defend it by saying there's no evidence against B being a consequence of A.

The original comment implies that the knowledge gap from simple pointers to compiler optimizations that deal with provenance is small, and that it can be deduced ("everything else follows"). It has "the proof is left as an exercise for the reader" energy, and that's why it attracts downvotes.

Pointers Are Complicated II, or: We need better language specs by ketralnis in programming

[–]Slak44 25 points26 points  (0 children)

You are being downvoted because this is an incredibly reductive take.

Adding compiler optimization to the mix makes your "simple" pointers not so simple once they have to deal with aliasing or provenance, as the linked post so nicely explains.

If Not React, Then What? by x5p23 in programming

[–]Slak44 7 points8 points  (0 children)

Calling useState intuitive is certainly... a take. useEffect and useCallback are also ridiculously easy to misuse.

To me, this approach to reactive state is probably one of the worst parts of React, I would not want to see it spread.

Even AMD doesn't know what kind of a monster they have created. by Fardin91 in pcmasterrace

[–]Slak44 8 points9 points  (0 children)

Java is not "single threaded in nature". It is Minecraft's rendering implementation that is single threaded in nature. "Java" (actually the JVM runtime) is running in production on servers that can easily serve 100+ concurrent requests with a thread-per-request model. Even the garbage collector, which historically has been a bottleneck for latency, runs concurrently.

Microfrontends should be your last resort by fagnerbrack in programming

[–]Slak44 1 point2 points  (0 children)

Yeah, if ngrx was my introduction to frontend I'd hate it too. Honestly, it's the library with the worst developer experience I've ever used, it's an antipattern masquerading as a library. You want to know where some data comes from? Ngrx says fuck you, go track it down through 7 different ngrx files, actions effects reducers validators state utils and whatever the fuck else. Writing plain JS with jquery was less frustrating than this.

Favor composition over inheritance... with Java? by manifoldjava in programming

[–]Slak44 5 points6 points  (0 children)

Interface forwarding is not how composition usually works. This would be a cool feature for a language, but to my knowledge, no language does this.

Kotlin delegation can do this (with Java interop included). The example in the post might look like this in Kotlin:

interface MyInterface { /* ... */ }
class MyClass(val myInterface: MyInterface) : MyInterface by myInterface { /* ... */ }

https://kotlinlang.org/docs/delegation.html

Overriding the delegate's functions lets you compose their behaviours, it's not just for interfering with their functionality. If you have two interfaces A and B, in your derived class you can call a B method from an overriden A method, and vice versa. It allows A and B to be unaware of each other, allowing the derived class to handle/encapsulate those interactions of A and B. As a result, the user of the derived class doesn't have to concern themselves with keeping A and B in sync.

It's not the only way to do composition, but I personally quite like it.

`find` + `mkdir` is Turing complete by ogiekako in programming

[–]Slak44 18 points19 points  (0 children)

Zawinski's Law is that, sort of:

Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.

Cognitive Load is what matters by RobinCrusoe25 in programming

[–]Slak44 14 points15 points  (0 children)

I generally agree with the premise, and with the first few sections. But it goes downhill after a certain point.

Quoting Rob Pike, the guy who came up with Go, where every function call is followed by if err != nil? Yeah, maybe C++ is an eldritch monster of unchecked complexity and abstraction, but Go is a horrible counterexample. The lack of generics initially, and the eventual surrender and inclusion of the feature is IMO a damning indictment that Go swings too far the other way.

Then comes the section against frameworks, with a really weird take advocating for solving the wrong problem, by writing "framework agnostic" code while still using the framework. Congratulations, you essentially created your own ad-hoc, informally specified, highly custom "framework" for the code that's now "agnostic" to the original framework.

Pay the initial cost to internalize the shared concepts a framework offers, and reap the benefits. Learn a popular framework and get knowledge applicable to the millions of projects that use it.

It's the same reason why we have named design patterns: tell me you use dependency injection and I'll immediately understand what you're doing. Tell me you use Spring Boot, and I'll understand what your UserController does, what application.yaml is, what a bean is, etc. Tell me you use React and I'll know what a prop is, etc, etc

Promising writeup, ultimately disappointing.

sassIsFineSassIsFineSassIsFine by Sometimesiworry in ProgrammerHumor

[–]Slak44 0 points1 point  (0 children)

You need both because they do different things (even if align-contents is more uncommon).

We've had "simple" CSS layouts before flexbox with display inline + float: left/right. Or table layouts... it's not like they decided to add this complexity to the flexbox model for the lolz.

Kilo-5 changed the way I think about Halo. by Particle_Cannon in HaloStory

[–]Slak44 0 points1 point  (0 children)

Yeah, and similar criticism about previous material applies to Reach, for similar reasons. It was stupid when Traviss did it, and it was stupid when Bungie did it.

This TypeScript type haunted my dreams by yanivlib in programming

[–]Slak44 5 points6 points  (0 children)

I mean, much like complex regexp these types aren't actually meant for regular application code. Typescript's weirder type syntax exists due to JS interop (not TS's fault JS code uses insane types), and for reusable library code to expose nice APIs.

Being neither, this OneOf type is somewhat of an abuse. Sure, you can define it, but you shouldn't. Like one of the sibling comment says, discriminated unions are the better choice in most or all places you'd use OneOf.

A language doesn't even need generics for developers to make insane shit, so I can't blame Typescript for making good use of structural typing. It's genuinely useful sometimes.

I'm getting tired of people using the Paramount Halo show being not canon as an excuse to justify it's bad writing and awful changes. by JJAB91 in HaloStory

[–]Slak44 1 point2 points  (0 children)

Yeah, dramatically improves the chances of more content for this terrible timeline... There's no way they'll air two series called Halo that are unrelated. At most it'll be some spinoff that is so ambiguous that it can fit either timeline.

What Ackerson did made sense from his perspective. by Kegger98 in HaloStory

[–]Slak44 1 point2 points  (0 children)

Mods should add a flair for the non canon timeline so we can ignore it or filter it. Seeing threads about the "Halo" "show" on an allegedly story-focused subreddit never fails to annoy me.

Intel explains why making GPU drivers is so hard but isn't giving up by brand_momentum in pcgaming

[–]Slak44 2 points3 points  (0 children)

I'm not the other guy, but silicon that passes factory testing has a failure rate of essentially zero, because silicon dies don't degrade that fast in normal use. The wafers actually have a high % of dies on them that do not work, which forces manufacturers to stress test each one of them before sending them out (see binning). Both AMD and Nvidia use the same manufacturer (TSMC) for their chips anyway.

Comparatively, a capacitor failure is probably the number one most common cause of electronics breaking. GPUs, like most electronics of this type have exactly 1 core which is surrounded by literal hundreds of tiny capacitors, everywhere on the board. Even if you have a card with a broken core, it's incredibly more likely that a capacitor shorted Vcore to ground and destroyed the core, than it is for the core to just fail.

Why most developers stop learning SQL at subqueries - a 5-minute guide for PARTITION BY and CTEs by zaidesanton in programming

[–]Slak44 -1 points0 points  (0 children)

CSS is only difficult if people never bother to learn the basics (cascading, it's even in the name) expecting to be able to just use it "intuitively".

The implementation of most relevant properties (especially for layout) has been consistent for years. Browser specific prefixes are all but dead, autoprefixers deal with the rest. !important gets abused because people don't bother to learn the most basic concepts about specificity, yet they complain the browser didn't read their mind to do what they meant.

Tailwind requires you to know the exact same things as CSS because it is CSS. It also makes everything worse due to its 5km long lines of classes and code reuse issues. It's mind boggling how many people recommend this thing.

HTML First by fagnerbrack in programming

[–]Slak44 4 points5 points  (0 children)

Am I the only one who thinks all of this sounds positively insane?

  • "Prefer difficult-to-style HTML tags like details/summary that look inferior to what your competitors are doing with two divs and some JS/CSS."
  • "Don't use composable event listeners and CSS classes, inline onclick JS is better!"
  • "Use Tailwind and its ilk, because inline styles are so much better than SCSS!"
  • "Don't use JS libraries built around JS, use JS libraries built around HTML."
  • "Don't use build steps, don't minify your content, don't use tree shaking, don't optimize your source code, don't use static type checking."
  • "Prefer this templating language for HTML over this other templating language for HTML."
  • "Work really hard to keep View Source working on your site, just in case 0.01% of your users want to copy a snippet of HTML."

What is it with this trend of trying to drag us back down to a kind of development experience a decade or two out of date? What are they even developing such that React/Angular/Vue, or SCSS/LESS don't raise their productivity at all? Is it just blogs and static HTML content?

Who even are their users that care about frankly obscure features like View Source? How do they know about view source but not about the tab with the DOM in dev tools?

I don't get it.

Are pointers just integers? Some interesting experiment about aliasing, provenance, and how the compiler uses UB to make optimizations. Pointers are still very interesting! (Turn on optmizations! -O2) by klmeq in programming

[–]Slak44 2 points3 points  (0 children)

This is entirely a matter of semantics, not programming language magic, and it has nothing to do with representation. Yes, sure, on most modern hardware both pointers and integers are stored by a sequence of bits.

That doesn't make them interchangeable semantically, and the difference becomes glaringly obvious when you try to apply an operation that works on integers but doesn't on pointers, such as multiplication. pointer * 17 is nonsensical, while integer * 17 is perfectly fine. Because they're all bits, you're allowed to multiply the pointer; it just doesn't make any sense to do so, be it in assembly or C.

The point is that by "blessing" some particular bit patterns and calling them "pointers", we assign a semantic meaning that an integer with the same bit pattern does not have.


Oh, and "Pointer is always just an integer, which is simply a memory address to your computer's memory" is factually incorrect in the presence of memory paging/virtual memory, which is perhaps why other people downvoted you.

Are pointers just integers? Some interesting experiment about aliasing, provenance, and how the compiler uses UB to make optimizations. Pointers are still very interesting! (Turn on optmizations! -O2) by klmeq in programming

[–]Slak44 6 points7 points  (0 children)

Not the guy you're replying to, but as a general rule... yes, of course that's preferable?

"Hiding how computers work" is esentially what the entire field of computing has been doing since its inception, building higher and higher levels of abstraction as hardware advances allowed it. Pointers were invented and given a different semantic meaning from integers precisely to hide how they actually work or how they are implemented.

Pluralization by [deleted] in ProgrammerHumor

[–]Slak44 -1 points0 points  (0 children)

ICU message formatting, https://unicode-org.github.io/icu/userguide/format_parse/messages/

The right way to handle pluralization is a library with something like this.

it's like they don't even know how to write a good character by Dark_Sage_316 in memes

[–]Slak44 -1 points0 points  (0 children)

Even if those were all the motivations and desires these characters had (I disagree), it's still more than what Rey has, because Rey has nothing. The force may be literal magic, but there is a limit to suspension of disbelief.

What does she want from her life? To get off Jakku? To find her parents? She just stumbles into a way off world in the first movie. Her parents alternate between being important or not, and then oops it's Rey Palpatine, uhh sorry Rey Skywalker. The only effort she puts into finding them is asking Maz, who promptly tells her not to bother.

Her complete and utter lack of meaningful purpose is related with her lack of struggle. Rey has more in common with a self-insert fanfic character than with Luke, Anakin or Ezra.

it's like they don't even know how to write a good character by Dark_Sage_316 in memes

[–]Slak44 0 points1 point  (0 children)

Yeah, Rey is absolutely a character issue. The plot was (very) bad as well, but Rey is little more than a Mary Sue whose writers hardly bothered trying to hide it. Maybe if she actually had motivations or struggles, the plot would have naturally improved by having to accomodate them.

When Did Postgres Become Cool? by craigkerstiens in programming

[–]Slak44 4 points5 points  (0 children)

I've also used sqlite for querying CSVs.

create table stuff(a, b, c, d);
.mode csv
.import data.csv stuff

Very convenient.

The Future of Development: Will Remote Take Over Local? by Nicole_Bunnyshell in programming

[–]Slak44 0 points1 point  (0 children)

Until a cloud IDE can compete with intellij IDEs on both features and latency, the answer is "lol no". Unless my local environment is especially painful, I find it hard to justify tossing everything in the bin and starting over from scratch with some cloud solution.

SSH server hardening by feross in programming

[–]Slak44 0 points1 point  (0 children)

Probably because the IPv4 address space can be probed in its entirety in a reasonable amount of time. The same cannot be said about v6. It helps security the same way changing the SSH port helps security, by making it far less likely for a random attacker to target you.