3
votes
1answer
119 views

A question about static types

How would you statically type the following JavaScript program function c(str) { c = eval(str); return c(str); } I'm not trying to start a flame war but I'm genuinely curious. I've always ...
1
vote
2answers
287 views

is JS a gradually typed language?

I was researching on statically typed and dynamically typed concepts and found out there is another type system called gradually typed. From wikipedia Gradual typing is a type system in which ...
50
votes
14answers
5k views

Is it a bad idea to return different data types from a single function in a dynamically typed language?

I come from a statically typed language background (Java). In Java, you have to return a single type from every method. For example, you can't have a method that conditionally returns a String or ...
7
votes
13answers
4k views

Would a statically typed alternative to JavaScript on webpages be practical?

Preference for dynamic and static typing is largely a matter of taste, and different people find them more or less suitable in different situations. My question is, would it be technically possible ...