Programming thread

  • 🐕 I am attempting to get the site runnning as fast as possible. If you are experiencing slow page load times, please report it.
muh bACKwards compatibility and sheit
A few of these are just a counterintuitive consequence of the floating-point standard (though JavaScript should always have natively supported more than floats). Most are a long-term price paid for the very temporary convenience of weak typing that was with JavaScript from the beginning. I definitely blame Perl 5 for the remainder of this crap not accounted for towards the beginning:
javascript-weak-typing-meme.webp
 
Most are a long-term price paid for the very temporary convenience of weak typing that was with JavaScript from the beginning.
weak typing (not dynamic typing, weak typing in particular) is the fucking devil
"hey let's put a bunch of convenient automatic conversion rules into this language so beginner programmers don't have as many errors to deal with" - most evil person to ever exist
 
weak typing (not dynamic typing, weak typing in particular) is the fucking devil
"hey let's put a bunch of convenient automatic conversion rules into this language so beginner programmers don't have as many errors to deal with" - most evil person to ever exist
Dynamic typing I can take or leave. I think maybe static with type inference is ideal (and apparently it can even work with operator overloading) but I still don't go to the extent of type hinting any of my Python code. But anyway yes weak typing is the devil barring a few principled exceptions. Ex: technically Python still uses strong typing for summing bools which is useful for telling how many of an iterable meet some criterion or other but it has a weak typing "flavor".
 
weak typing (not dynamic typing, weak typing in particular) is the fucking devil
"hey let's put a bunch of convenient automatic conversion rules into this language so beginner programmers don't have as many errors to deal with" - most evil person to ever exist
The funny thing is that stupid magic like this actually often makes things harder for beginners to understand. Just look at how many Docker users don't properly understand the distinction between containers and images because its convenience commands "helpfully" blur that distinction.
 
weak typing (not dynamic typing, weak typing in particular) is the fucking devil
"hey let's put a bunch of convenient automatic conversion rules into this language so beginner programmers don't have as many errors to deal with" - most evil person to ever exist
A lot of these aren't even a problem with implicit conversions per se, but rather a problem with allowing implicit conversions between unrelated types ([]==0 should obviously be illegal in any sane language), greatly exacerbated by operator overloading (half the nonsense in the list would be eliminated if concatenation had its own distinct operator).

Icon is by far my favorite research language of all time and these sorts of problems are exceedingly rare because operators generally expect their operands to belong to a fixed set of related types and anything that can't be converted into one of those types results in a runtime error (so trying to add an integer to a hash table is an error). The cost of this is having a different operator for every class of types (= for numeric equality, == for string equality, === for object identity, + for numeric addition, ++ for union, || for string concatenation, ||| for list concatenation, etc.). I think they should have tightened it up a little more and allowed only conversions that can be performed in a single step, so that 5 + '321' would be an error instead of 128 (character set '321', canonically '123' -> string "123" -> integer 123), but on the whole it works well, even though I wish they allowed you to add optional type declarations instead of using comments.
 
A lot of these aren't even a problem with implicit conversions per se, but rather a problem with allowing implicit conversions between unrelated types ([]==0 should obviously be illegal in any sane language), greatly exacerbated by operator overloading (half the nonsense in the list would be eliminated if concatenation had its own distinct operator).

Icon is by far my favorite research language of all time and these sorts of problems are exceedingly rare because operators generally expect their operands to belong to a fixed set of related types and anything that can't be converted into one of those types results in a runtime error (so trying to add an integer to a hash table is an error). The cost of this is having a different operator for every class of types (= for numeric equality, == for string equality, === for object identity, + for numeric addition, ++ for union, || for string concatenation, ||| for list concatenation, etc.). I think they should have tightened it up a little more and allowed only conversions that can be performed in a single step, so that 5 + '321' would be an error instead of 128 (character set '321', canonically '123' -> string "123" -> integer 123), but on the whole it works well, even though I wish they allowed you to add optional type declarations instead of using comments.
I really like how lisp does comparisons, where you can relax/tighten them up as needed.

 
  • Thunk-Provoking
Reactions: Belisarius Cawl
weak typing (not dynamic typing, weak typing in particular) is the fucking devil
"hey let's put a bunch of convenient automatic conversion rules into this language so beginner programmers don't have as many errors to deal with" - most evil person to ever exist
I would expand this to include languages that try to be "user friendly" with an "English-like syntax". SQL kind of gets away with it, but the innumerable army of other such languages are mostly in the dustbin of history, and for good reason. Trying to mirror people's hazy, imprecise ideas about things makes things more complicated for precise thinkers, and imprecise thinkers don't imprecisely think the same way, so they're going to get caught in the bullshit too.
 
COBOL is still quite alive and well
COBOL was actually the specific reason I said "mostly", but I thought it would burden the post too much to include. I probably could have changed "SQL gets away with it" to "COBOL and SQL get away with it" without dragging down the flow of the post too badly, but oh well.

And yeah, COBOL seems like the worst offender for this particular sin. Binary Coded Decimal is proof, imo, that niggerlicious software has always existed. (Though I do think it's worse now than it used to be.)
 
COBOL was actually the specific reason I said "mostly", but I thought it would burden the post too much to include. I probably could have changed "SQL gets away with it" to "COBOL and SQL get away with it" without dragging down the flow of the post too badly, but oh well.
What languages that are or were popular do you consider the biggest offenders here?
 
What languages that are or were popular do you consider the biggest offenders here?
At some risk of revealing myself to be a fraud, I don't have an especially long list of well-known offenders (then again, this would be a list of languages that failed to get popular, so by definition I'm less likely to be aware of them.) I often notice "cute" DSLs and "scripting languages" that have this pattern, but I can't remember any offhand.

The biggest example of a popular language that does this sometimes is Python. For example:
newlist = [x if x != "banana" else "orange" for x in fruits]
It's debatable, but to me this syntax feels "cute" in the wrong way. Operator overloading also gives people the opportunity to get "cute" with redefining operators in ways that are ergonomic to the author, and confusing to everyone else. Some "builder" patterns in the Java world also get "cute" like this. (What follows is not a real example; it's been a while since I've encountered this.)
DogBuilder().isHolding(new Bone()).isOfBreed(breed).andHas(new FourLimbs()).build();

I think there are two core causes of this:
  1. "Wow, this would be so easy if all these languages weren't so pedantic. When I talk to people, they aren't so picky. If I could just make a less picky language, everything would be easy and programming would be fixed!!"
  2. I am a mathematician, and I think programming should look more like math. (Operator overloading feels like this to me. In Mathematics, for example, multiplication is an extremely broadly defined operation, and is routinely extended to apply to some new domain. Such extensions, in the programming context, often mean "the computer does something completely different".)
Both, I think, stem from new programmers looking around at the status quo and thinking "Wow, all this programming stuff is really pedantic and hard. It's probably that way because programmers are weird/stupid unlike me."
 
It's debatable, but to me this syntax feels "cute" in the wrong way. Operator overloading also gives people the opportunity to get "cute" with redefining operators in ways that are ergonomic to the author, and confusing to everyone else. Some "builder" patterns in the Java world also get "cute" like this. (What follows is not a real example; it's been a while since I've encountered this.)
List comprehension is a great feature, but the python version does feel pretty weird to use indeed.
I often notice "cute" DSLs and "scripting languages" that have this pattern, but I can't remember any offhand.
I actually really like DSL's for many use cases. But yeah, trying to make it read like english usually goes wrong (Altough, if its instead encoding business rules into them it can be quite nice to work with. For example, with f# with computation expressions you can gain a lot of conciseness to express stuff like this
Code:
let processOrder () =
    orderFlow {
        TakeOrder
        VerifyOrder
        DispatchOrder
        ErrorHandle errorfunc
    }
Where TakeOrder, VerifyOrder and DispatchOrder can all fail, but ErrorHandle catches any errors raised in it. Much cleaner than having a ton of try catches and such. (You can set up the computation expression to skip any subsequent functions automatically on error)
It's also extensible/easily changeable because it's all typechecked + easy to define new custom functions in, that are only valid in the CE's scope. In this case the state is all implicit, and the orderFlow evaluates to the result.

Pretty sure do notation in haskell is quite similar.


Edit: This seems like a much better example than what I came up with: https://blog.devgenius.io/inline-assembly-in-f-net-language-6d70ab9f58c1

(I think wlashin explains computation expressions better than I ever could https://fsharpforfunandprofit.com/posts/computation-expressions-intro/ )
 
Last edited:
At some risk of revealing myself to be a fraud, I don't have an especially long list of well-known offenders (then again, this would be a list of languages that failed to get popular, so by definition I'm less likely to be aware of them.) I often notice "cute" DSLs and "scripting languages" that have this pattern, but I can't remember any offhand.
I'm thinking you would probably not like NetLogo or other forms of Logo:
Operator overloading also gives people the opportunity to get "cute" with redefining operators in ways that are ergonomic to the author, and confusing to everyone else.
There was a nigger, who came up with this idea:
C++:
cout << "Hello world" << endl;
Well, that's pretty niggerlicious.
I am a mathematician, and I think programming should look more like math.
I tend to think the alternative to doing what Grace Hopper did with COBOL would look more like APL and I can't say I'd want that outcome
 
I forgot to put quotes, but I intended that second bullet point as a criticism of math people who impose their way of thinking onto the domain
They've been doing that since before people were writing code, CS has always been a type of applied mathematics
 
Operator overloading also gives people the opportunity to get "cute" with redefining operators in ways that are ergonomic to the author, and confusing to everyone else
on the other hand "cute" in a nice way is overloading the / for filesystem::path in C++, i found that pretty amusing when i first saw it

for the most cursed operator overloading candidate i submit muti dimensional analog literals
 
on the other hand "cute" in a nice way is overloading the / for filesystem::path in C++, i found that pretty amusing when i first saw it

for the most cursed operator overloading candidate i submit muti dimensional analog literals
Makes me think of some of the shenanigans the people contributing to the IOCCC get up to https://www.ioccc.org/index.html

like https://gist.github.com/Property404/e31b99deb3527159e183

C:
//  Are you there god??/
??=define _(please, help)
??=define _____(i,m, v,e,r,y) r%:%:m
??=define ____ _____(a,f,r,a,i,d)
main(__)<%____(!_(-~-??-((-~-??-!__<<-
??-!!__)<<-??-(!!__<<!!__))+-~-~-??--~-~
-~-~-~-~-??-(-~-~-~-~-??-!!__<<-~!!__),-
??-!__))<%??>%>_(__,___)??<____
(printf("please let me die??/r%d bottle%s"
" of bee%s""""??/n",(!(___
%-~-~!!___))?--__+!___++:__+!___++,!(__-!!___)
&&___%-~-~!!___??!??!!(___%-~-~!!___??!??!__
-(-~!!___))?"":"s",___%-~-??-!!___<-??-!!___?
"r on the wall":"eeeeeeer! Take one down,pass ??/
it around")&&__&&_(__,___),"mercy I'm in pain")??<??>??>
 
"hey let's put a bunch of convenient automatic conversion rules into this language so beginner programmers don't have as many errors to deal with" - most evil person to ever exist
i would be very interested in knowing what the thought process of these language developers is because i would argue that it makes the code only harder to read with little to no benefit. even this argument of "but beginner programmers have it easier then" is flawed because beyond the first stage of having to learn what the various data types are, it only introduces more difficulties when you've to debug code that uses weak typing. maybe there's a good reason for that unbeknownst to me though.
 
i would be very interested in knowing what the thought process of these language developers is because i would argue that it makes the code only harder to read with little to no benefit. even this argument of "but beginner programmers have it easier then" is flawed because beyond the first stage of having to learn what the various data types are, it only introduces more difficulties when you've to debug code that uses weak typing. maybe there's a good reason for that unbeknownst to me though.
Tbf, JS is kind of designed to never truly crash. It'd rather limp along with wrong data than crash.
 
Back