Hacker News new | past | comments | ask | show | jobs | submit login

> Javascript is actually untyped, not weakly typed (untyped means no type declarations, not that it has no types)

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.




It's been popping up lately. It's meant as a smear on dynamically typed languages, because dynamic has a positive connotation and untyped is decidedly negative. Pretty similar in intention to uni-typed.

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.


Uni-typed is actually a very specific technical term. Mathematically you can prove type theorems about languages regardless of whether they implement types as language features. Dynamic languages are thus modelable like this and when you do so the first approximation is to say that a dynamic language is a language with a single type (uni-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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: