There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

itsraining , in JavaScript

<span style="color:#323232;">{} + 0
</span><span style="color:#323232;">>> 0
</span><span style="color:#323232;">
</span><span style="color:#323232;">0 + {}
</span><span style="color:#323232;">>> "0[object Object]"
</span>

I’m going home.

Blackmist ,

<span style="color:#323232;">0 == []
</span><span style="color:#323232;">>> true
</span><span style="color:#323232;">
</span><span style="color:#323232;">"0" == []
</span><span style="color:#323232;">>> false
</span><span style="color:#323232;">
</span><span style="color:#323232;">0 == "0"
</span><span style="color:#323232;">>> true
</span>
pewgar_seemsimandroid , in I'll have you know, my fork of a github repo has 3 stars 😎

4 follower’s on mastodon

RavenLuni , in How big is your desk?
@RavenLuni@furry.engineer avatar

@ZeroCool my desk is currently 52,572,500 miles long but I need a bigger one.

orangeboats , in JavaScript

This is why I try my damnedest not to write in weakly typed languages.

string + object makes no logical sense, but the language will be like “'no biggie, you probably meant string + string so let’s convert the object to string”! And so all hell breaks loose when the language’s assumption is wrong.

zalgotext ,

You don’t necessarily need types for that kind of thing though, a strict linter that flags that code works just as well

Blackmist ,

Some automatic conversion is fine.

a=3+0.2

print(“Hello {name}. You are {age} years old”)

That kind of thing. But the principle of least surprise definitely applies. If you get to the point where you’re adding two booleans and a string, I feel like the language should at least say something. At least until the technology exists for it to physically reach out of your screen and slap you.

veganpizza69 , in JavaScript
@veganpizza69@lemmy.world avatar

Who would use that kind of type coercion? Who? I want to see his face.

dejected_warp_core ,

I take this as less of a “I can’t use this intuitive feature reliably” thing and more of a “the truth table will bite you in the ass when you least expect it and/or make a mistake” thing.

flying_sheep ,
@flying_sheep@lemmy.ml avatar

Just use a formatter. It’ll show you that the second one is two statements:

  1. {} (the empty block)
  2. +[] coerce an empty array to a number: new Number(new Array())
dejected_warp_core ,

I totally get that: use the right tools and you’ll be okay. This applies to many technologies in this space.

With respect, I still take this advice like hearing “look out for rattlesnakes if you’re hiking there.” It might be safer to just hike where there are no rattlesnakes, instead.

flying_sheep ,
@flying_sheep@lemmy.ml avatar

You’re right, of you have compete freedom, do that. If the place you want or need to go to is most comfortably reachable via rattlesnake road, bring boots.

In other words, if you don’t think the wasm landscape is mature enough to build a web thing with it, you are stuck with JavaScript, but you don’t have to rawdog it. I haven’t run in a single weird thing like this in years of writing typescript with the help of its type system, ESLint and a formatter.

marcos ,

It’s not even the coercion that is the problem here. The types are already bad by themselves.

1rre , in How big is your desk?

Docker fan mindset

frank , in How big is your desk?

I have a KVM switch so I can control my array of computers with one monitor setup. I have a normal desk and a big closet to house all the computers.

PlexSheep ,

We just have a warehouse with a few big computers. We just use our desks to access them.

netizen , in JavaScript
@netizen@programming.dev avatar
DeltaWingDragon , in The only correct way to indent
@DeltaWingDragon@sh.itjust.works avatar

`Null

shield_gengar , in JavaScript
@shield_gengar@sh.itjust.works avatar

Just be better lmao

YourPrivatHater , in How I date

I don’t have Netflix either but i know a thing or two about the internet…

lugal , in How I date

Rust and chill

herrcaptain ,

Rust and Bust.

debounced , in How I date
@debounced@kbin.run avatar

it satisfies the borrow checker or else it gets the hose again

5714 ,

If the borrow checker fails, the thing in their hand might throw some very effective error messages.

Wooki ,

method exists, but the trait bounds were not satisfied

TootSweet , in How I date

I think that’s just how every Rust developer learns Rust.

muse , in How I date
@muse@fedia.io avatar

This would unironically work on me

candyman337 ,

I mean they’ve got a gun so I’d imagine so

muse ,
@muse@fedia.io avatar

Bonus points

NatakuNox ,
@NatakuNox@lemmy.world avatar

We call those “marital aids”

Anticorp ,

What are you gonna do? Shoot me?

blanketswithsmallpox ,

Breaking: Man shot in house after repeatedly killing wife in game while naked.

northendtrooper ,

At this point it would take this for me to learn javascript.

Tyoda ,

Luckily, nobody is this passionate about liking javascript.

EpicFailGuy ,
@EpicFailGuy@lemmy.world avatar

SHUDDERS

Anticorp ,

Your loss!

Holzkohlen ,

Tbf, I also really don’t want to learn Rust. Overhyped dreck

turmoil ,

How dare you

flying_sheep ,
@flying_sheep@lemmy.ml avatar

[citation needed]

Klear ,
tacosplease ,

GW BASIC or GTFO

frezik ,

The Rust compiler tends to turn my impostor syndrome to 11. I assume she has some kind of humiliation kink and I do not consent.

Anticorp ,

You didn’t say the safe word! The lessons continue.

lauha ,

“But you didn’t tell me the safe word”

“That’s not the safe word either”

AeonFelis ,

This is Rust. You don’t need a safe word - safe is the default. You need an unsafe word instead.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • lifeLocal
  • goranko
  • All magazines