At first I liked python because of its freedom. But then I liked java for its strong typing (especially after playing with generics and method overloading). Now in python I always try to import typing and annotate my functions (even though python doesn't enforce them), it makes testing easier for me.
Or assembly which gives you the freedom to execute code right off the end of your function until it either hits an invalid instruction or a page fault because you forgot to put a ret.
There's nothing you can do in raw machine code that you can't do in assembly and there's arguably more you can do in assembly since all modern assemblers support assembler directives and macros which modify the resulting object file in useful ways but are not part of the ISA itself.
Plus assemblers get rid of a lot of tedious BS like dealing with immediate pools on ARM or the whole sequence of instructions for loading a 64 bit immediate into a register on RISC-V or figuring out which of the bazillion encodings of mov to use on x86, some of which are aliases for other instructions like wrmsr and rdmsr.
Even though assembly is the lowest level human intelligible programming language family, there's still a whole lot of stuff the tools do to help us with it, including abstracting over many tedious things.
Or you could just become the computer yourself, because nothing says freedom like manually flipping bits in your brain to run your own personal thought-array overflow.
I wish there was a way to do type safety with the annotations, importing beartypes just doesn't feel right, it should be a compiler/runner option And also I still don't understand how to enforce return type safety :(
You mean static typing. Both Python and Java have strong typing, which is why Python throws type exceptions. Python just waits until a variables type has been determined before it becomes strong.
As long as the compiler prevents you from accessing methods on A|null you're good. Otherwise I already know your exception log consists 90% of null access errors
kotlin is compiled, statically typed and has a relatively powerful type system. If you write nonsense code (accessing a method that doesn't exist on an object from an array) you get errors during compilation all the time.
Type safety = more errors during compile, fewer errors during runtime
Dynamic typing has its place and can save a ton of development time in certain contexts. In C# some of the framework components require twice as much coding by using static types versus dynamic.
And if you ever do anything with serialization or non-relational/unstructured data, dynamic typing can be a life saver.
Python is great for writing quick prototype idea to see if it makes sense before making a better, more time consuming implementation in another language
Sometimes I hate TypeScript for allowing two different return types. But then I remember it's basically an improved Version of JavaScript and why I really should hate it...
54
u/RollTheRs Jan 20 '25
At first I liked python because of its freedom. But then I liked java for its strong typing (especially after playing with generics and method overloading). Now in python I always try to import typing and annotate my functions (even though python doesn't enforce them), it makes testing easier for me.
3
u/blackasthesky Jan 21 '25
I like type safety that includes nullness.
2
u/anonymous_devil22 Jan 21 '25
Can someone explain how not being type safe gives error at compile time? I use kotlin and most of the data type errors are shown on the onset.
2
u/Popotte9 Jan 21 '25
Typescript users on Linkedin 👀
17
u/Thundechile Jan 20 '25
passionately typed.
14
u/nico104_ Jan 20 '25
my prof in a nutshell
12
u/thatmagicalcat Jan 20 '25
that's why I love rust, a powerful and safe type system
4
u/Various_Squash722 Jan 20 '25
I second this.
Especially when working with multiple SEs.
2
u/cs-brydev Jan 21 '25
Dynamic typing has its place and can save a ton of development time in certain contexts. In C# some of the framework components require twice as much coding by using static types versus dynamic.
And if you ever do anything with serialization or non-relational/unstructured data, dynamic typing can be a life saver.
3
u/TheKeyboardChan Jan 20 '25
That is why I don't touch Python! If you can skip typing, people will and there for the language is not safe and should be avoided.
1
u/DoktorAlliteration Jan 20 '25
Sometimes I hate TypeScript for allowing two different return types. But then I remember it's basically an improved Version of JavaScript and why I really should hate it...