Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
atheist9985119dI love me some static typing. I also love python so I'm currently in an abusive relationship...
-
Liebranca1100119dBut if it's incredibly inconvenient at the most fundamental level then perhaps it's only worse higher up!
-
jestdotty5646119dhow do I exist in a static type universe pls
inb4 I write JavaScript duck typing into rust -
lorentz15183119dI need that free beer to cope with having to read all implementations of an interface to figure out what the set of allowed return values is, just to then discover that some of those implementations are actually returning a value outside the set assumed by most consumers and the only reason it's still working is because the situations that would pair up old providers with new consumers are kinda rare
-
lorentz15183119dto be clear, expectations are volatile, that's natural. It's our job to ensure that the correctness of our code is permanent.
-
Lensflare17494119dPeople who hate static typing are essentially comparing JS with C++. Both are bad, but for completely different reasons. JS turns out to be slightly less bad.
It’s sad that you don’t realize that you can have the best of two worlds, static typing and a beautiful, convenient and succinct syntax. -
atheist9985119d@Lensflare what lang do you think gives the best of both worlds? Coz it probably doesn't
-
Lensflare17494119d@atheist Swift
Before Swift I coded with C, C++, Java, C#, Objective-C, Kotlin, JavaScript, and a litte bit of Python, Perl and the exotic Autohotkey language.
So I have wide spectrum of experience -
Lensflare17494119d@kiki "I don’t need to worry about that because otherwise it wouldn’t compile" is how I code.
-
Lensflare17494119d@atheist The thing is, I kind of agree. Being associated with Apple is probably the one major problem that it has.
Swift is open source and is available for Windows and Linux and even embedded systems.
But a lot of people just see Apple and dismiss it for that single reason. -
atheist9985119d@Lensflare that's cool, last I looked (years ago) there were problems with the standard library, outside of macos it was limited/not fully open source
-
atheist9985119d@jestdotty but I'm a bad programmer and need static typing to spot my stupidity... 😂
-
atheist9985119d@jestdotty I think my concern is as much about me as it is the idiots that use my code because I *know* they won't do the kind of analysis you're talking about (I don't either but I fix shit when it breaks, they whine about it)
-
atheist9985119d@jestdotty alas, I'm good at my job and a lot of people around me aren't. So when shit goes wrong, I end up dealing with it. Add to that I'm the only one in the company that's both a decent programmer and a decent mathematician, so there are projects I get given that few others can handle on their own. Or the fuckwit data sci folks come up with some clever idea that might as well have been scribbled in crayon and they expect me to make sense of it and turn it into something that can be put into production.
Long story short, I'm a bit fucked off with my job... -
lorentz15183119d@Lensflare I actually kinda like C++. It bothers me that the unverifiable risks become UB and not a runtime crash (and especially that this isn't really configurable) and it has some ridiculous defaults that are only there because of backwards compatibility, and way too much implicit behaviour, but the options for metaprogramming are already great and rapidly improving, and crucially, the type system is strong enough that you hardly ever have to bypass it to get shit done.
-
Lensflare17494119d@lorentz I also have a kind of love hate relationship with C++.
Regarding UB: I think a crash would require some checks and would cost some runtime cycles. It’s against the philosophy of C++ ^^ -
lorentz15183119d@Lensflare I know why they don't do it, I'm just not sure they should. I get the impression that C++ deviated from the zero-cost principle once and they're now stuck supporting heap-allocated exceptions for the rest of eternity, so they responded to that mistake with extreme zealotry that inhibits a proper discussion of the zero-cost principle as one of many values.
-
lorentz15183119d@Lensflare To be clear, I definitely wouldn't suggest that C++ should completely eliminate UB, only maybe offer tools to limit it to the tiny fraction of any real-world codebase that actually needs it. The vast majority of C++ code is perfectly happy with wrapping stuff in shared_ptr and they would be fine with references that wrap a weak pointer and abort on dangling dereference too, just to name an example of the possible runtime-detectable errors.
-
atheist9985119d@lorentz c++ undefined behaviour is undefined by the spec but most ub is deterministic. The classic example is an infinite loop with no observable side effects, a compiler can optimise out the loop because an infinite loop is ub therefore should never happen and the compiler can assume it doesn't.
-
lorentz15183119d@atheist well yeah but you notice an infinite loop, much more than a use-after-free or a data race
-
atheist9985119d@lorentz so by the sounds of it you prefer rust, but rust is built around a leaky abstraction. Data should be either shared between threads and immutable or unshared and mutable. Rust extends that to anything that might possibly do anything unexpected, should be given immutable data or moved. It goes too far the other way. I don't think there's a language in existence that can prevent mutex deadlocks, so at a certain point you have to write good code no matter what. I prefer FP over rust, make everything immutable by definition, no leaky abstraction, no type coloring. It's the same problem with async in js. You have one async call, suddenly everything is an async call.
-
atheist9985119d@lorentz also use after free in c++ probably means you're using raw pointers and not modern c++. Shared pointers reset to null which dereferencing is technically ub but will near universally crash something and raise a null pointer exception. So use after free I'm not convinced is a true problem anymore.
-
atheist9985119dRust also allows you to do unsafe shit so you can punch through abstractions same as any other language.
-
CoreFusionX3517119d@atheist @lorentz
Well, I dare say that at least most of the C++ STLs and runtimes I've worked with have debug layers for precisely this kind of shit (dangling references, null pointers, thread shit, etc.) that are fairly effective.
That's the beauty of being able to link to different runtimes. -
awesomeest1209119d@atheist and here I thought I was the biggest masochist.
I loathe python... and basically anything that counts whitespace formatting as valid elements to a language... also loathe it for its non-static typing... but unfortunately it's a necessary evil for some of the mass algos im creating. -
awesomeest1209119dIronically, i disagree with most of your views on awesome.
Free beer... shitty in USA... some dark german beer sure, but i still am more of a high proof liquor fan. Everything else is just a chaser.
Ruby annoys me.
Static typing is my friend. I dislike just about anything that tries to assume shit about my variables.
If i wanna make a variable, It WILL be explicitly declared! -
atheist9985119d@awesomeest pyright on strict. It's a pain in the ass but I find it makes code so much easier to navigate. Also ruff.
-
atheist9985119dIf you ever see a docstring linter called "what the doc" , then I've actually finished my parser/renderer/linter for restructured text... So add that to the list.
-
awesomeest1209119d@Lensflare What issue do you have with C++? I mean... I'll use C vs C++ whenever possible but c++ isnt horrid.
-
awesomeest1209119d@atheist
i tend to avoid things like that for the same reason i tend to avoid frameworks... something, somewhere, will annoy me... then annoy me again... by 3x im so deep in modding the annoyances away that ive just written my own system.
it's a serious issue when youve been modding things, far beyond what is meant to be configurable, since early childhood... you just know too much. needing to google or check some docs is often the only thing that keeps me from making and going down one hell of a hyperfocus rabbit-hole.
it's much more of an issue now that i need to keep some form of standards so others in my company dont blow their heads off trying to figure out how tf my code works. -
atheist9985118d@awesomeest pyright is (IMO) the better python static type checker, I highly recommend. Ruff, a linter and auto formatter (if desired) is pretty good and unlike the stupidity of black, can be customised. I'd recommend pyright at a minimum but get why not linters. But yeah, I'm writing my own for the same reason. It seemed like a good idea at the time...
-
awesomeest1209118d@atheist yeah... i just made my own version of a debugging mod... basically adds like modified print lines that alert if a variable changes type... i was drunk one night and python decided that a discord ID string, explicitly declared as such, should turn into an int... fucked up a bunch... grinded out a major debugging module in a adhd hyperfocus episode whilst intoxicated.
-
Lensflare17494118d@awesomeest I dislike C++ independently of C.
My gripes come from when I compare it to modern languages like Swift or Kotlin (or even C#).
It is too archaic and has legacy stuff like header files and the include system. It is elegant but completely annoying in practice.
It is unsafe by design.
Some practically zero const abstractions like the shared pointers do fix it for some cases but that’s not enough. -
Lensflare17494118d@atheist
> I don't think there's a language in existence that can prevent mutex deadlocks
Swift (again 😄) in version 6 introduces a concurrency system which comes with compile time correctness guarantees about code which involves data shared between threads.
Of course, this requires you to write correct code, but at least the compiler is able to check it and emit an error if the code contains possible thread safety problems, so this is a big win.
It's worth mentioning that it’s possible to opt out of it. -
CoreFusionX3517118d@Lensflare
Ironically, most of the stuff you mention is actually inherited from C, and is needed to keep compatibility with it.
However, I agree that the C++ committee is often very slow to push for changes in the name of keeping backwards compatibility.
Hopefully modules will soon replace headers.
As for compile time checking of concurrency issues, I don't think it will ever work past some very basic instances. In addition, if it requires you to write correct code in the first place, what's the point? You already wrote correct code anyway. -
Lensflare17494118d@CoreFusionX it’s hard to explain it when you are not familiar with Swift. Swift 5 has already prepared some of the stuff needed for this to happen and it really works. It feels magical. Basically it forces you to write correct multithreading code (if you opt in), which can be checked by the compiler. It works for any arbitrary complex case, not just basic stuff.
It works on the principles of mutable vs non mutable state, exclusive access and structured concurrency.
You can look into the official docs if you are interested. -
awesomeest1209118d@Lensflare can your magical swift let me keep audio priority on my music when safari (or anything else) is open?
-
awesomeest1209118d@Lensflare ok... do it for friendship and\or to prove swift is a worthy "elegant" language... ill even move swift to the top of my 2learn list... its currently 4th (i think)... but i already have books and a folder of 1000s of pages of docs ready
-
Lensflare17494118d@awesomeest you realize that your problem is not language level but platform level?
-
awesomeest1209117d@Lensflare ofc... but what else can be used to fix it (i mean aside from using another system to puppeteer it)?
-
Lensflare17494117d@awesomeest no idea 😄. that’s not my area of expertise. My guess is that it’s not possible. But if it’s possible, then you can do it with Swift 😉
It’s true and you know it
joke/meme