That's not what any of that means.
"No type declarations" only means just that. Haskell has no obligatory type declarations due to global type inference and nobody is calling Haskell untyped.
Untyped means untyped. None of the APIs or code are built around types, structurally or by name. It's just a one big union type of possible JavaScript values all over the place even if that's not what you meant when you wrote the function.
Being interpreted has nothing to do with type-checking. Haskell's REPL is an interpreter. Using a library (Hint) you can eval arbitrary Haskell from strings in a type-safe manner.
You can even parse arbitrary data from strings in a type-safe manner without resorting to an interpreter:
-- throws error
read "blah" :: Int
-- returns 1
read "1" :: Int
via the magical joy that is Haskell typeclasses. Trivial but still very nice stuff.Type-checking requires statically derivable information. You won't get any of the niceness unless you design your language around it.
I don't care about syntax either. It don't think it really matters and it takes all of an evening to get used to syntax from any language.
Yeah, `this` is freakin' ridiculous.
I've never really heard the term untyped before -- I guess I'm old school and still call that dynamic typed. But JavaScript is also weakly typed. It will automatically convert strings to numbers, etc. Some languages, like Python, are dynamically typed but also strongly typed: No type declarations but no automatic conversions.
http://stackoverflow.com/questions/23282683/is-clojure-uni-t...
Edit: Sorry, learned something new just now. I'm very, very wrong.
Untyped is where operations are valid on everything because it's all a sequence of bits.
Dynamic is completely different and refers to when the type is discovered.
Sorry. However, Javascript is definitely dynamically typed.
The reason this is valuable is it opens up directly the techniques for "hybrid typing" such as PHP->Hack and Javascript->Typescript. It also is the basis for the compiler using type inference to accelerate certain portions of the code.
This doesn't mean it isn't an issue, just you haven't encountered a situation where it is.
* I think the syntax argument is laughably ridiculous. Programming languages that live in glass houses shouldn't throw stones. Just today, I've seen three links to guides "to learn basic Haskell syntax", two of which contradicted each other.
And you've never seen three guides to "learn basic Javascript syntax" which contradict each other?
You can argue it both ways, as far as I am concerned. Javascript like any other language has issues, what exactly those issues are... depends greatly on what you use Javascript for.
You're right, but it seems to be fairly rare. I've only once ever seen static type checking help find bugs in rarely-used code paths, and that was a single occurrence five years ago.
>And you've never seen three guides to "learn basic Javascript syntax" which contradict each other?
No, I haven't. The only things I can think of off the top of my head that a JS newbie would find contradictory are semicolons and declaring arrays with [], both of which are used by the vast majority. I've only seen one codebase ever that used new Array(), and only a handful that didn't use semicolons unless necessary.
>You can argue it both ways, as far as I am concerned. Javascript like any other language has issues, what exactly those issues are... depends greatly on what you use Javascript for.
Good point. Claiming Javascript is issue-free is as ridiculous as claiming that (to quote this guide) "Javascript sucks".
I found this to be a very bizarre statement, given the existence of dynamic typing. For anyone else confused, this is the best discussion I could find of the issue:
http://stackoverflow.com/questions/9154388/does-untyped-also...
So unless one is having a discussion with someone like Bob Harper, dynamic typing absolutely makes sense and is not a misnomer.
Untyped, however, is a bag of worms that you can't really get out of. To some it means no type declarations, in which case Haskell is untyped to some extent with its excellent support for type inference. To others, untyped means the complete absence of types and type checking (static or dynamic)...like doing something completely unchecked at run time with a void* in C. The views are diverse among programmers, let alone theorists! So I just avoid this term in any case.
If you're trying to solve the perception of being snooty and unpleasant (as mentioned in this thread), downvoting everything isn't going to get you far.
In case you've issues with this, you may just use `Object.handleEvent()`, and the this-object will be your object (or function). Why is everyone complaining about this behavior, but no one is using the built-in feature that would be the perfect solution to the problem?
Javascript does not define the implementation details. It does not have to be interpreted, and in fact I don't believe any modern implementation is interpreted. Javascript is generally compiled to byte code which is then run in a VM, or native machine code (V8 at least does this). There is no reason javascript could not have a static type system, there are statically typed scripting languages. It is dynamically typed by deliberate decision, not "we can't do it any other way".
* Javascript is actually untyped, not weakly typed (untyped means no type declarations, not that it has no types) and I don't see that as a problem.
* Being an entirely interpreted language, JS cannot have static type checking. This has not been an issue in my experience.
* I think the syntax argument is laughably ridiculous. Programming languages that live in glass houses shouldn't throw stones. Just today, I've seen three links to guides "to learn basic Haskell syntax", two of which contradicted each other.
* I agree with their statement on `this` behavior. This (pardon my pun) is one of the places where JS's well-intentioned DOM-manipulation features cause problems with it as a language.