Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by nothingmuch (Priest)
on Dec 16, 2004 at 22:34 UTC ( [id://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?

-nuffin
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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://415498]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-04-19 02:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found