What does Jow Forums prefer?
Dynamic vs Static Typing
I don't really understand dynamic typing, is it supposed to be easier? It's just such a pain in the ass when you want to do mathematical operators and string concatenation on the same line and javascript shits itself treating everything as a string. But what do I know, VB.NET is my favorite syntax.
Wtf
If done properly, the annotations you write in static typing are things you would want to write as comments anyway. So why not let a compiler make your code much faster and catch errors? Plus it makes for good IDEs and refactoring which is a godsend
Only downsides of static typing:
>some languages are shit and don't have basic type inference so there is too much repetition
>compile times on large projects (if your build sucks)
>lack of hotswap (if your runtime sucks)
>working with outside data (SQL, json, etc) can be more awkward since you have to specify the schema you expect
To be fair, that's Javascript's fault, not necessarily dynamic typing. Strongly-typed dynamic languages like Lisp don't have that problem.
implicit type coercion is a mistake
what city is this
A solution that would take bazillions of classes and methods with static typing can be done with far fewer classes and methods with dynamic typing.
I use dynamic typing when it's relevant to use it. Static typing should be your default one as it is more secure and clearer to read.
Depends on usecase. If low-level, static all the way. The higher level you go or if you are prototyping shit, dynamic is better.
Have fun dealing with json outside of JS.
Dynamic typing is for niggerjeets
hong kong
heading there in a few days, will keep you updated
Dynamic typing isn't all done the JS/Python way. A better example is in Lisp: since you have dynamic typing, you can accept arguments of multiple types and deal with ways of handling bad combinations yourself. And certainly, most built-in functions are very strict about types being correct lest they throw errors.
The "+" operator, in a nutshell, is dynamic typing gone too far. Otherwise, it has its uses.
Hong Kong
powerful static typing > dynamic typing > half baked static typing (no HKTs or worse)
>Dynamic typing isn't all done the JS/Python way.
JS way and Python way are two completely different animals.
JS is dynamically, weakly typed, Python is dynamically, strongly typed. When it comes to operator overloading, JS way is 'typecast wildly and hope for the best', Python's is 'everything is an interface if you squint'.
Python is workable, but becomes a pain in large projects. JS is a pain, period.
static
Only non-programmers will find this funny
Why not both? Flash was a meme, but as3 was fucking nice.
> var I:int = 1
> var d:* = "any type"
>Math.max()
>-Infinity
>Math.min()
>Infinity
I... wha...
Data shouldn't have types other than the number of bytes it occupies.
If you wanna add them as float use a float_add operation, as ints; int_add and so on.
data shouldn't have types. Everything is a machine word.
It makes sense if you interpret max and min instead as sup and inf.
The supremum of an empty set is -infinity and its infimum is infinity. This is as for the empty set you can always find a lower upper bound and a larger upper bound as the first condition holds vacuously
>[]==0
>true
kek
use ===, don't write shit code and you'll be fine
static, if possible
>life without types
Yeah those are fine. Best way to think about it is that adding elements to a set can only *decrease* its minimum. To keep this property the only valid value for min([]) is Infinity
This is the one thing in that list I actually liked, in Java min gives you an option and it's a pain
Dynamic typing is just indirect static typing.
static, dynamic is for fucking hacks
Technically min and max shouldn't be defined for empty sets as they should be contained within the set. I guess as min/max, inf/sup coincide for finite nonempty sets it's fine. I guess they always want the function application to have a value; i.e be a function rather than a partial function
Only difference is one fails at compile time the other at runtime, its obvious which is better.