this post was submitted on 21 Nov 2023
257 points (90.0% liked)

Programmer Humor

35561 readers
315 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] SamsonSeinfelder@feddit.de 102 points 1 year ago (1 children)

1998 called, it wants its java applets back

[–] dauerstaender@feddit.de 22 points 1 year ago (1 children)

If it’s WASM it’s here to stay.

[–] frezik@midwest.social 11 points 1 year ago (1 children)

Did someone get Java applets working on WASM? Who is this maniac?

[–] AVincentInSpace@pawb.social 7 points 1 year ago

Java applets idk, but we do have Flash

[–] redcalcium@lemmy.institute 83 points 1 year ago

You can already do this with the power of webassembly.

[–] Synthead@lemmy.world 81 points 1 year ago

Look up WebAssembly.

[–] zacher_glachl@lemmy.world 43 points 1 year ago (1 children)

As a python developer and user of websites, please no. The web is already a slow mess and my laptop is already spinning up fans on some websites that really shouldn't do anything much more complicated than load text and images from a database and display them. CPython would make it exponentially worse. At least pick a sensible performance focused implementation.

load more comments (1 replies)
[–] CanadaPlus@futurology.today 42 points 1 year ago* (last edited 1 year ago) (6 children)

Yes. Please. Although something strongly typed would be even better. It's ridiculous the world runs on a language built in 2 weeks.

[–] Virkkunen@kbin.social 40 points 1 year ago (6 children)

It's also ridiculous to think it's still the same language that was built in two weeks, like absolutely no work was done in it over time.

load more comments (6 replies)
[–] Gebruikersnaam@lemmy.ml 27 points 1 year ago (1 children)

Python is strongly typed, but it is also dynamically typed.

[–] CanadaPlus@futurology.today 9 points 1 year ago (2 children)

TIL. Obviously I've avoided using it much.

So how does that work? Is there a few implicit conversions that are allowed, but if you really write something weird it will complain?

[–] Gebruikersnaam@lemmy.ml 11 points 1 year ago (1 children)

Yes, it has no implicit conversions like JS or R. It does, however, allow you to not specify the type of a variable and even change it without complaining. Even if you add types these are only hints that won't generate errors unless you use external type checking (e.g. mypy).

[–] tryptaminev@feddit.de 9 points 1 year ago (2 children)

example:

i = 5.0//2

list[i]

throws an error because i is double and the list-index expects an integer.

so for it to work the code needs to look like this:

i = int(5.0//2)

list[i]

meanwhile this works:

i=5

i= 'abcde'

[–] Chrobin@discuss.tchncs.de 2 points 1 year ago (1 children)

Isn't // integer division?

[–] Gebruikersnaam@lemmy.ml 3 points 1 year ago (1 children)

It is but if you start with a float you get a float back.

[–] Chrobin@discuss.tchncs.de 2 points 1 year ago (1 children)

You're right, I did not know that. Thanks!

[–] Gebruikersnaam@lemmy.ml 1 points 1 year ago

Was really surprised by this too, because iirc Python 2 did not do this.

[–] dzervas@lemmy.world 1 points 1 year ago (1 children)

you can do i: int to make this error out

[–] Gebruikersnaam@lemmy.ml 6 points 1 year ago (1 children)

No, type hints are not enforced.

[–] HappyRedditRefugee@lemm.ee 6 points 1 year ago

In python you always have the right type, cause everything is an object

[–] DarkenLM@kbin.social 26 points 1 year ago (2 children)

And yet somehow it evolved to become something that will last to the heat death of the universe.

I've grown used to it with time, though. Once you know it's "quirks", it's not so bad.

[–] CanadaPlus@futurology.today 4 points 1 year ago (1 children)

I guess the internet just grew that fast. The first arrival took all and locked everybody in.

Now, we have just two browsers that are widely used, so maybe we do have an opportunity to go back and fix it. Go sounds like it's a pretty popular choice for statically typed, imperative high-level language.

[–] DarkenLM@kbin.social 16 points 1 year ago (1 children)

Honestly, given the context of a browser, Javascript's "Everything is better than crashing" philosophy does not seem too out-of-place. Yes, the website might break, but at least it would be theoretically usable still.

Yes, a statically typed language would help, but I'd rather not have one that is "these two types are slightly different, fuck you, have a segfault", but rather one that is slightly more flexible.

[–] CanadaPlus@futurology.today 4 points 1 year ago* (last edited 1 year ago)

Actually, that's a good point, in scripting fatal type errors can happen at runtime. I guess Python is the right choice then, given it's maturity and popularity, and then you can code the complex stuff in whatever you want via WASM like other people mentioned.

Not even "not so bad", I would say that as a scripting language it's fantastic. If I'm writing any actually complex code, then static typing is much easier to work with, but if you want to hack together some stuff, python is great.

It also interfaces extremely easily with C++ through pybind11, so for most of what I do, I end up writing the major code base in C++ and a lightweight wrapper in Python, because then you don't have to think about anything when using the lib, just hack away in dynamically typed Python, and let your compiled C++ do the heavy lifting.

[–] words_number@programming.dev 25 points 1 year ago (5 children)

Python is actually mostly strongly typed. Strongly (e.g. can't use a number as a string without explicitly converting it), but dynamically (can change type of variable at runtime). You probably would prefer a statically typed language and I agree.

load more comments (5 replies)
[–] PeWu@lemmy.ml 5 points 1 year ago (1 children)
[–] Zangoose@lemmy.world 12 points 1 year ago (2 children)
[–] skullgiver@popplesburger.hilciferous.nl 4 points 1 year ago* (last edited 1 year ago)

[This comment has been deleted by an automated system]

[–] PeWu@lemmy.ml 2 points 1 year ago

Couldn't agree more.

[–] lukas@lemmy.haigner.me 4 points 1 year ago

Java Applets!

[–] scubbo@lemmy.ml 30 points 1 year ago

laughs in WASM

[–] slazer2au@lemmy.world 10 points 1 year ago (1 children)

No, but that is because I can't do much scripting.

[–] kubica@kbin.social 22 points 1 year ago (1 children)

´import scripting_abilities´

[–] slazer2au@lemmy.world 10 points 1 year ago* (last edited 1 year ago) (1 children)

Main()
Select * from stack_overflow where working_scripts is "closed (duplicate)"

[–] dzervas@lemmy.world 3 points 1 year ago

you have a multi-billion cluster at your disposal it seems

[–] ICastFist@programming.dev 3 points 1 year ago

Will that make Ren'Py VNs play natively on firefox? If not, I vote no

[–] mesamunefire@lemmy.world 2 points 1 year ago (2 children)

Yes I would give actual money to see this native and supported.

[–] skullgiver@popplesburger.hilciferous.nl 5 points 1 year ago* (last edited 1 year ago)

[This comment has been deleted by an automated system]

[–] words_number@programming.dev 4 points 1 year ago (1 children)

Unfortunately that support would be worthless if only firefox does it.

load more comments
view more: next ›