[plt-scheme] type of language
On Wed, 9 Dec 2009 18:14:11 +0200
emre berat nebioğlu <beratn at gmail.com> wrote:
> i guess become a Computer programmer or Computer Scientist is not
> only about writing code but also it is about some specific stuff like
> type of language.
Well, the nice thing about such things is, that you can learn it and
classify a language yourself.
Weak/Strong typing: If a language is weakly typed, it tries to convert
the types automatically and guess what you want to do. For example,
consider "1" + 1. If a language is weakly typed, the answer is usually
2 (or "11"), because it guessed what you wanted to do. If it is
strongly typed, you get an error/exception that this is not valid, one
cannot add a string and an integer together.
Popular example of weak typing: PHP
Popular example of strong typing: Scheme :)
Dynamic/Static typing: is the type information enforced? Can a
"variable" change its type? Is it possible to call a function with
types that weren't considered by the implemnentor of the function?
Do you need to declare the types of function arguments and return
values?
Popular example of dynamic typing: Scheme :)
Popular example of static typing: Java
Popular example of static typing with type inference: ML
(type inference = you don't need to specify the types, the language
finds out about them by itself)
Lexical scope/dynamic scope: this is a bit difficult to explain clearly
and a bit pointless, since most languages use lexical scopes. If boils
down to how a language determines a value of a variable from an outer
scope.
Popular example of a lexically scoped language: Scheme :)
Popular example of a dynamically scoped language: Elisp, I think; and
Common Lisp has support for it too.
Interpreted/Compiled language: This is actually wrong, since a language
does not specify whether it is compiled or interpreted, the
implementation does. Furthermore, compilation can mean anything:
compile at runtime (JIT), compile to bytecode, or compile to native
code.
Popular example of a JITted Scheme: PLT Scheme
Popular example of an interpreted Scheme: TinyScheme
Popular example of a Scheme that compiles to bytecode: Bigloo
Popular example of a Scheme that compiles native code: Gambit-C
Hope that helped,
Marek