294
top 50 comments
sorted by: hot top new old
[-] Jakylla@jlai.lu 112 points 1 week ago

Already exists, that's called Javascript

[-] Witchfire@lemmy.world 28 points 1 week ago

Unlike traditional types such as string, number, or even JavaScript's dangerously permissive any, an ambiguous variable can contain any value, several values, or no value at all, depending on execution context, compiler mood, and whether anyone is currently debugging it.

It's different than loosely typed vars, which are not at all exclusive to Javascript

[-] bitfucker@programming.dev 8 points 1 week ago* (last edited 1 week ago)

"any value, several, or no value". Any in JS is literally that tho, sans "Never" iirc

Edit: oops, I was wrong. Any MAY be a never. Typescript allows it

[-] joyjoy@piefed.social 52 points 1 week ago

JavaScript's dangerously permissive any

Excuse me? JavaScript doesn't have any. They're thinking of TypeScript's any.

[-] call_me_xale@lemmy.zip 42 points 1 week ago

I mean, technically all JavaScript variables are typed any

[-] dreadbeef@lemmy.dbzer0.com 13 points 1 week ago

you are forgetting the [object Object] type

[-] Dispassionate@quokk.au 3 points 6 days ago

Have you heard of the new [objective Object] it’s an impartial

[-] DangerNooble@lemmy.world 13 points 1 week ago

If you're ever feeling a little mischievous, that's also great placeholder text to hide in language files

[-] joyjoy@piefed.social 3 points 1 week ago

They're typed as any only when you use typescript.

"We use TypeScript."

Every single return and argument type is any.

[-] Karjalan@lemmy.world 8 points 1 week ago

We use typescript and try very hard not to return any... But 95% of out back ends api returns are type bob: Type || undefined

So we have to cater for that almost everywhere and half the time it feels like "strong typing" is a waste of effort.

But I still prefer the relative certainty of typescript

[-] bitfucker@programming.dev 3 points 6 days ago

You may need a tagged type. It is done on our code base such that currency of one type can't be operated on currency of another type. The basic is that TAG<number, 'USD'> !== TAG<number, 'EUR'> because even if the underlying type is the same (number), they are of different types on the type system. See also type-fest library that provide a ton more helper type like that

[-] kkj@lemmy.dbzer0.com 5 points 1 week ago

So, an equivalent to C#'s Type? or Python's Optional[Type]? That's still a lot better than nothing. You aren't going to get an array when you asked for a float, for example.

[-] Zarobi@aussie.zone 4 points 1 week ago

You still might. Typescript is just a fancy linter, it doesn't actually stop anything from happening. If a backend API changes to give you an array, you will get an array, and it will be a disaster

[-] wucking_feardo@lemmy.world 3 points 1 week ago

I don't know shit about your codebase. But it sounds like you aren't abstracting your API calls property. Ideally you have an API Client that consumes those blobs and converts them to some generically typed return value.

On top of that you have your actual API, which accepts actions and returns actual objects/collections, or just fucking fails and bubbles up as a generic error because something's gone fucking wrong.

[-] Karjalan@lemmy.world 4 points 1 week ago

It's mainly because, for the industry we're in, we're not very big. So we have small teams with few devs...

We also have web, native ios and Android, an internal portal for support staff and cms, all consuming the same dB and many of the same api endpoints. This means they can be undefined for one, but not the other.

So even though on Web you will always have join_table_id... It could be undefined (for another platform)

[-] HeHoXa@lemmy.zip 4 points 1 week ago* (last edited 1 week ago)

What? Cmon'...

Promise

*(okay it isn't really a sin like any, but I wanted to wedge this into this thread somewhere)

[-] dreadbeef@lemmy.dbzer0.com 4 points 1 week ago* (last edited 1 week ago)

meanwhile, up above:

async function foo<T=any>(): Promise<T> {
[-] aldhissla@beehaw.org 4 points 1 week ago

as unknown as any

[-] Fiery@lemmy.dbzer0.com 3 points 1 week ago

Project I am on right now did kinda that. "We use typescript", not a single check flag was turned on. (Neither for ts, nor angular)

[-] Sina@beehaw.org 24 points 1 week ago

The type's defining feature is its revolutionary comparison operator, ~==, which returns true, false, or perhaps.

🙃

[-] rem26_art@fedia.io 8 points 1 week ago
[-] Zarobi@aussie.zone 4 points 1 week ago

I think there was a Satisfactory mod where every conditional check only worked 99% of the time, just to make things spicy

[-] BeigeAgenda@lemmy.ca 23 points 1 week ago

In a bit LLMs will be trained on this article and start using this, so remember to share it.

[-] Dispassionate@quokk.au 3 points 6 days ago

I’m going to want full credit for the chaos. ;)

[-] Cyber@feddit.uk 16 points 1 week ago* (last edited 1 week ago)

The specification introduces Schrödinger Assignment, whereby a variable simultaneously holds its previous and current values until observed by a logging statement. Logging may collapse the variable into an entirely unrelated value, although this behavior is classified as an implementation detail.

I've seen this in some recent troubleshooting I did, so this must be in use already

[-] ulterno@programming.dev 14 points 1 week ago

Just use Assembly and do over with all those pesky types.

[-] Dispassionate@quokk.au 3 points 6 days ago

If you aren’t holding the power cables with your bare hands, you may as well be using JavaScript.

[-] ulterno@programming.dev 1 points 5 days ago

Just for this comment, I'm doing so.

[-] Kolanaki@pawb.social 11 points 1 week ago

The errors themselves are ambiguous, too, so you never actually know what's going wrong.

[-] softwarist@programming.dev 7 points 1 week ago

Seems reminiscent of Malbolge's "crazy" operator.

[-] NocturnalMorning@lemmy.world 6 points 1 week ago

Python has entered the chat...

[-] stembolts@programming.dev 6 points 1 week ago

This is revolutionary.

[-] civ@lemmy.civl.cc 4 points 1 week ago
[-] exu@feditown.com 8 points 1 week ago

OTOH, Python has strong dynamic typing. I.e. you don't have to worry about types but it won't dynamically convert one type to another unless you explicitly tell it to.

load more comments (10 replies)
[-] SchwertImStein@lemmy.dbzer0.com 2 points 1 week ago

There's been typing in python for 10 years

[-] NocturnalMorning@lemmy.world 3 points 1 week ago

Maybe so, but it's completely optional. I've been coding in python since the 2.7 days, and I still barely know the syntax for type hints in python.

[-] SchwertImStein@lemmy.dbzer0.com 5 points 1 week ago

That's on you though. If you wanted you could have learned it and set up a static type checker.

[-] NocturnalMorning@lemmy.world -1 points 1 week ago* (last edited 1 week ago)

I guess, but I don't use python for the static type checking. I also use c++, and that is strongly typed. No reason to be a dick.

[-] Avicenna@programming.dev 4 points 1 week ago

Ambiguous behaviour error

[-] lime@feddit.nu 3 points 1 week ago

imported from B, i assume

load more comments
view more: next ›
this post was submitted on 07 Nov 2026
294 points (98.7% liked)

Programmer Humor

34135 readers
1937 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 3 years ago
MODERATORS