Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are all scripting languages dynamically typed?

I am using TCL. It is a scripting language and it does not enforce or allow type delaration of variables. It is instead a dynamically-typed language with ducktyping. The type of a variable is assumed by the interpreter according to the value assigned to it.

I would really like to know is there are scripting languages that are strictly/strongly typed.

share|improve this question

closed as unclear what you're asking by gnat, Bart van Ingen Schenau, James McLeod, MichaelT, GlenH7 Dec 13 '13 at 21:19

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Interpreted languages are often dynamically typed (which does not mean they "have no data types") but not necessarily:… – thorsten müller Dec 13 '13 at 9:12
Many people use "scripting language" to mean "language that I don't like, for whatever reason" or "language whose type system I don't like". Please clearly define the term "scripting language" and give examples. (interesting article) – user39685 Dec 13 '13 at 15:13
Could you clarify what you mean as a difference between scripting and non-scripting languages? That distinction is becoming more and more blurry with every passing day. – user40980 Dec 13 '13 at 16:14
@user61852 that's a bit silly, isn't it? The problem here is that we don't have an objective, technical definition of "scripting language". – user39685 Dec 13 '13 at 19:29
I actually think the Wikipedia article does a good job of illustrating the general confusion around the issue: "In principle any language can be used as a scripting language", "The term 'scripting language' is also used loosely to refer to [...]"; "[...] hence the ambiguity about whether a language 'is' a scripting language [...]", "A scripting language can be viewed as a [...]". (emphasis mine). A lot of vague words used there. – user39685 Dec 13 '13 at 22:26

Well, in my nomenclature -- which isn't universal, but whose is? -- TCL is not a dynamically typed language, it is an untyped one like assembly languages, BCPL, BLISS.

Statically typed languages have types deduced by a static analysis.

Dynamically typed languages have a type attached to values.

Untyped one have only one kind of values (words for BCPL and BLISS, strings for TCL) and the type is deduced from the operation which is applied more or less blindly on the values.

Automatic conversion may blur the difference between dynamically typed languages and untyped one. Evolution may also give an untyped language some dynamically typed flavor (that's perhaps the case for TCL -- I've not used for too long --, it's also the case for some shells which started as untyped and then acquired values which are of a different kind -- arrays for instance) making their behavior inconsistent and difficult to explain.

Duck typing is another axis. It's a way to check type conformance. It's a variant of structural typing where only the used characteristics are checked. It can be used in statically typed languages (templates in C++ is duck typing); in dynamic languages the check may be delayed to use time.

share|improve this answer

No. Whether a language is statically or dynamically typed, or weakly or strongly typed, has nothing to do with interpretation/compilation, which is an orthogonal implementation detail.

Perhaps the best example to use here would be Hugs, The Haskell interpreter. For those unaware, Haskell is a very strongly typed language with a very powerful type system, and is somewhat of a poster child for strong type systems with solid mathematical backing.

Consider also a language such as Scala, which has a type system with similar power and is very difficult to place between compiled and interpreted. It "compiles" down to JVM Bytecode, which is then interpreted/compiled/JITted depending on various implementation details of the JVM it happens to be running on.

share|improve this answer
I may be nitpicking, but the typing discipling is decidedly not an implementation detail, but rather an important part of the language design. Also, your answer appears to exclusively use the "scripting language = interpreted" definition, which may not be what OP means. – delnan Dec 13 '13 at 15:24
"Scripting" is not an implementation detail, it's a mode of usage. Scripting language is embedded into some larger system or used to glue smaller system components. Not sure I ever seen Hugs being used for scripting purposes (not saying it's not possible or not reasonable). – SK-logic Dec 13 '13 at 15:32
@delnan: Er, right you are, that sentence is rather the wrong way around! – Phoshi Dec 13 '13 at 16:52
@SK-logic: You can embed and glue stuff together in many many languages, like C! I wouldn't call C a scripting language, though it's certainly capable of acting like one and certainly is used as one. I think my definition would simply be a language which puts high semantic density above being suitable for maintenance of large applications, though I'm not sure Haskell really qualifies under those rules it certainly strikes the high semantic density one off. – Phoshi Dec 13 '13 at 16:55
@Phoshi, if you embed C (which had been done with tcc, for example), C will become a genuine, real scripting language. C++ is a proper scripting language indeed, in ROOT, for example. – SK-logic Dec 13 '13 at 17:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.