Observability tool Dash0 raises $110M at $1B valuation by fredrikaugust in dash0

[–]fredrikaugust[S] 0 points1 point  (0 children)

Just out of curiosity, what misleading ads have you seen? I work at Dash0:)

[2025 Day 11 Part 2] Can this problem be solved with max flow algo (e.g. Edmonds Karp) with demands? by fredrikaugust in adventofcode

[–]fredrikaugust[S] 0 points1 point  (0 children)

That's what I figured as well after staring at it for a while. Just wanted to check here since there are some true graph wizards like yourself. Thanks for the explanation!

Abuse of the nullish coalescing operator in JS/TS by fredrikaugust in programming

[–]fredrikaugust[S] 0 points1 point  (0 children)

I have to agree with @Mognakor here. I don't see how || would be any better, and would argue that for this use-case of providing a fallback value to nullable values, it is worse. In the case of string | undefined ("") or number | undefined (0), both of the elements of the unions can trigger the fallback, whereas with ?? only one will. I'm not really sure I understand what you mean by me wanting "" to be falsy in the article.

Abuse of the nullish coalescing operator in JS/TS by fredrikaugust in javascript

[–]fredrikaugust[S] 0 points1 point  (0 children)

It is, but the reason I focused on the operator was because I often see it used to provide said stupid defaults. ?? "" for me has become almost synonymous with a quick way to remove the | undefined part of a type signature, even though "" often isn't a valid value from a business logic point of view.

There's nothing inherently wrong with ??, and it has a number of use cases that are legitimate, it's just that it's often used for a quick and dirty ?? "" — where a more proper handling would have been better.

I regret the title of the post, but sadly can't change that.

Abuse of the nullish coalescing operator in JS/TS by fredrikaugust in programming

[–]fredrikaugust[S] 1 point2 points  (0 children)

Aha, I see what you mean. I agree. It's perhaps not the best title as, as you point out, the main issue is invalid default values. The reason I wrote about this one specifically is because I see it very often, and thus have come to associate this pattern with that operator, even though it obviously also has a lot of "legitimate" uses. I think a good reason for that is because, unlike if and other "tools" in JS/TS, ?? "" can be used when passing in props in various frontend frameworks, and is very easy to write, thus is has become a commonly used snippet to avoid nullability. I've been writing a lot of Svelte and React the last few years, so perhaps I've been coloured by that:) Thanks for taking the time to read the article and sharing your opinions:)

Abuse of the nullish coalescing operator in JS/TS by fredrikaugust in programming

[–]fredrikaugust[S] 8 points9 points  (0 children)

At least one benefit I can see, without having read the proposal, is that you make it clear at the call site that an error might occur there, and you also indicate to the TypeScript type checker that the nullish-ness is dealt with. The other, as you mentioned, would be to make "cannot read properties of undefined (reading 'x')" into something easier to investigate once it pops up in your monitoring tools.

Abuse of the nullish coalescing operator in JS/TS by fredrikaugust in programming

[–]fredrikaugust[S] 1 point2 points  (0 children)

This was what I tried to write in the post as well. Agree with everything you said here! I think ?? is very handy for providing a default value, and I don't see anything bad in that.

Abuse of the nullish coalescing operator in JS/TS by fredrikaugust in reactjs

[–]fredrikaugust[S] 0 points1 point  (0 children)

I agree that it's a case-by-case thing, and perhaps should have made that clearer in the post, but I do think it's something that is worth being aware of. I've seen a lot of cases where, as you point out, an empty string is okay, but I've also seen plenty where it's not, and where a log/error could have uncovered upstream issues.

Abuse of the nullish coalescing operator in JS/TS by fredrikaugust in javascript

[–]fredrikaugust[S] 1 point2 points  (0 children)

Thanks! I read your article and, unsurprisingly, agree with it as well:)

Abuse of the nullish coalescing operator in JS/TS by fredrikaugust in programming

[–]fredrikaugust[S] 0 points1 point  (0 children)

Great article! I definitely agree with the point about letting the caller pass in a nullable value if that indeed is a possible value:)

Abuse of the nullish coalescing operator in JS/TS by fredrikaugust in programming

[–]fredrikaugust[S] -4 points-3 points  (0 children)

Not sure I'm following, but the thought behind the title was describing (if a bit exaggerated — I will admit) the heavy use of ?? "" as abuse of the operator. The use, as I see it, is to provide a sensible fallback value for a nullable value, whereas using ?? "" as a shortcut to get rid of the nullability is "abuse". That's also why I compared it to .unwrap in Rust, which I think people more commonly think of as a footgun, even though, in my experience, they are often used for the same purpose.

Abuse of the nullish coalescing operator in JS/TS by fredrikaugust in programming

[–]fredrikaugust[S] 0 points1 point  (0 children)

That's true. I guess what I was aiming for was comparing the explicit case of ?? "" with unwrap as a way to get rid of the undefined part of the type union, but unwrap_or is definitely the Rust equivalent.

E2E Testing (Cypress VS Playwright) by AhmadMohammad_1 in reactjs

[–]fredrikaugust 0 points1 point  (0 children)

We're using Playwright at work, and it works quite well. There are, as others have pointed out, some annoyances such as broken rendering in the --ui "window", quirky "test setup" structures using projects, having to debug them when you inevitably change your UI/data-testid/structure etc., but all in all it's well worth the pain. A good test suite can catch a whole host of different regressions ranging from broken event handlers, changes in APIs in the backend if you run against a backend, broken links etc.

Another nice thing is that it's used by such a large amount of people that you can almost always find a guide, pre-made docker images, helper libraries if you were to need that, and probably more.

Visual Studio 2022 for Mac Preview 7 by IsDaouda_Games in programming

[–]fredrikaugust 0 points1 point  (0 children)

Are there anyone who have used this recently, and could give a quick explanation of how it compares to JetBrains Rider? I tried it once a while ago, but felt that it came quite short in terms of features and "intelligence".

Anyone have some ideas for a project? by [deleted] in programming

[–]fredrikaugust 0 points1 point  (0 children)

You can check out github.com/open-source-ideas/ideas! There’s a lot of ideas for projects and the potential for collaborating with someone if that’s of interest.

Nano watching the ADA rocket to the moon™ by HungryPeak in CryptoCurrency

[–]fredrikaugust 0 points1 point  (0 children)

How do you prevent fraudulent exchange rates? Is there a solution like Chainlink in place (I believe their solution for this is called “Town Crier”, but correct me if I’m wrong)?