Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: The most useful form of typing is...

by nothingmuch (Priest)
on Dec 16, 2004 at 22:34 UTC ( #415498=note: print w/replies, xml ) Need Help??

in reply to The most useful form of typing is...

Is everyone's opinion on what the difference between strong and dynamic typing in sync?

I have the impression that static is that it's known in advance, and strong is that it's enforced. Usually strong typing is a prerequisite to static typing, but does not imply when the type check is made.

Does anyone have a better definition?

And what's the diff between weak and dynamic?

zz zZ Z Z #!perl
  • Comment on Re: The most useful form of typing is...

Replies are listed 'Best First'.
Re^2: The most useful form of typing is...
by Errto (Vicar) on Dec 19, 2004 at 23:00 UTC

    I like your definitions, so I'll try to put together a short list of some of the languages I know and where they fit in the scale.

    • Strong and static: Haskell, ML, PL/SQL, Java (but only if they implemented generics properly so you wouldn't need typecasting)
    • Strong and dynamic: Perl, Lisp, Scheme
    • Weak and static: C, C++, Pascal, Java (as is)
    • Weak and dynamic: Javascript, VB, bash

    The reason (as I understand it) that it is possible to have weakly-typed but also statically-typed languages is because of typecasts: you are essentially instructing the compiler to ignore the type declarations you've already given it. Also note that the first two languages I listed under Strong and Static allow total type polymorphism so that the same functions and data structures can apply to arbitrarily many types, but compile-time resolution still has to be possible.

Re^2: The most useful form of typing is...
by hardburn (Abbot) on Dec 22, 2004 at 20:15 UTC

    Your definitions are close to what is in the litature. Really, "strong" and "static" are orthoginal. Being static means that your language needs to have some means of determining the types at compile time, while strong means those types are difficult to change during execution (runtime). Pascal/C/etc. determine the types via special syntax (int foo, bar; and such), while more modern Hindley-Milner type systems can figure it out based on what you do with the variable the first time you use it.

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://415498]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-07-17 03:21 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (354 votes). Check out past polls.