this post was submitted on 13 Dec 2023
14 points (100.0% liked)

programming

174 readers
1 users here now

  1. Post about programming, interesting repos, learning to program, etc. Let's try to keep free software posts in the c/libre comm unless the post is about the programming/is to the repo.

  2. Do not doxx yourself by posting a repo that is yours and in any way leads to your personally identifying information. Use reports if necessary to alert mods to a potential doxxing.

  3. Be kind, keep struggle sessions focused on the topic of programming.

founded 11 months ago
MODERATORS
 

And how would you describe your political tendencies? I have a theory that more MLs are gonna be into static typing and more anarchists are gonna be into dynamic typing.

all 27 comments
sorted by: hot top controversial new old
[–] [email protected] 10 points 11 months ago* (last edited 11 months ago)

It's about choosing the right tool for the job. The job is programming and the tool is rust

[–] [email protected] 7 points 11 months ago

one true leftist, static typing

[–] [email protected] 7 points 11 months ago* (last edited 11 months ago)

Static typing > dynamic typing, imo. I mostly work with C/C++

I’m an ancom.

[–] [email protected] 7 points 11 months ago (1 children)

Static is always better than dynamic.

You haven’t felt true pain than trying to debug a 20 year old Perl script to find out that someone accidentally passed in one to many zeros to a function which caused all the arguments to be off by one and the dynamic checker just rolled with it and blew up silently.

[–] [email protected] 6 points 11 months ago (1 children)

I think making dynamic languages so common for web apps is the real sin tbh, so many different types of data to deal with, where casting between different data types often causes unsound states and horrible inconsistencies. I'd go to bat in favor of dynamic typing for writing small scripts for automating simple tasks, but I have no clue how it became the standard for everything.

[–] [email protected] 6 points 11 months ago* (last edited 11 months ago)

It's because Python and JS became the big web development languages and both of them use dynamic typing. Though Python tries to do a sort of inferred typing system with PEP standards and now type hinting.

I think in principle, having a loosely typed language is good, but in practice no one really follows the rules well enough. It puts too much trust in the programmer to do type checking themselves.

It would be best if it was static by default, and allowed for dynamic types to exist for handling weird inputs gracefully instead of immediately throwing type errors.

[–] [email protected] 5 points 11 months ago* (last edited 11 months ago) (1 children)

Marxist-Leninist, static typing for the win! You will use Rust, and you will like it, or else...

[–] [email protected] 2 points 11 months ago

(Segmentation faults, null pointer dereferences, data races, garbage collector latency spikes) stalin-gun-1stalin-gun-2

[–] [email protected] 4 points 11 months ago

ML. I almost completely write in Julia so my take is going to be a bit wonky/abnormal. For the kinds of stuff I write, having the option to static is great sometimes, but it makes it vastly easier to have the ability to dynamically type. If I had to worry about types more than I do it would probably result in a 33% increase in programming time.

[–] [email protected] 4 points 11 months ago

static rust enthusiast, probably more of an ml type but i don't advocate any specific tendency.

reminder to everyone to not get into actual sectarianism in the comments.

[–] [email protected] 3 points 11 months ago (1 children)

ML. Static typing is great but sometimes I want to be more vague especially when I'm dealing with big ass template classes. auto comes in handy big time. C++. Although if I'm writing in C the decision is basically made for me

[–] [email protected] 3 points 11 months ago (1 children)

Ever tried Rust? It has a pretty smart type inference engine that actually gives you feedback and in many IDEs you can have it autofill its inferences. Only time it kinda borks up is with iterators which tend to have extremely long type names since there might be multiple layers of generics and specifiers. But you can do something like let res: Vec<_> = some_iterator.collect() and it figures out what goes in the _ for you.

[–] [email protected] 3 points 11 months ago (1 children)

I haven't but Rust is definitely growing in the embedded space. I'll actually have to check it out sometime soon

[–] [email protected] 4 points 11 months ago

It's growing everywhere bugs-stalin

Hexbear runs on Rust, even, and I've found it pretty fun to peruse the repo and learn some things from it.

[–] [email protected] 3 points 11 months ago

Lol, ML forged in the fires of Haskell and spreading the gospel of Rust here.

Actually writing Rust for my job now. It’s nice.

[–] [email protected] 2 points 11 months ago

ML. Dynamic, though i do use type hints most of the time
(i mostly use gdscript)

[–] [email protected] 2 points 11 months ago (1 children)

Ancom in favor of static typing. I avoid reassigning variables at all, let alone with an object of a different type.

[–] [email protected] 2 points 11 months ago

I'm also mostly in favor of static typing, but I think the major usecase of dynamic typing is having a broad sort of polymorphism, where you're free to think of variables just as what they can or can't do, even if they're immutable. Of course that behavior can still be implemented with statically typed languages with interfaces/traits but it's more work. It's worth noting that it is also much safer, and it helps you iron out your model's inconsistencies, where dynamic typing often hides that you're doing something that fundamentally shouldn't make sense.

[–] [email protected] 1 points 11 months ago* (last edited 11 months ago)

Good post. Strongly prefer static typing. Red not black. I like Typescript. Unfortunately I mostly write in Solidity, which has godawful type systems (only got typedefs like a year ago), no real objects, and no polymorphic structs.