Cameron~

On Wed, 01 Dec 2004 16:53:32 +1000, Cameron Zemek <[EMAIL PROTECTED]> wrote:
> The FAQ mentions that the JVM and CLR (.Net VM) are not suited to
> dynamic languages. I was wondering why this is the case.
> 
> Also could the Parrot VM be used effectively with strong typing
> languages. I would like to at some stage try to implement a proof of
> concept of a language that has strong typing. For example:
> def name = new string (maxLength = 15)
> name = "this name is too long" # throws an InvalidValue exception
> def postcode = new integer (minValue = 0, maxValue = 9999)
> postcode = -1 # throws an OutOfBoundsException
> 
> Basically, the idea is to be able to set constraints on variables, and
> define new datatypes that have contraints. Also be able to set methods
> that can do custom validation of the new value. The idea of the language
> is for use to write database-centric applications.

I don't think that what you are referring to there is actually strong
typing.  Strong typing is more generally concerned with detecting type
errors at compile time (as oposed to range errors at runtime).  While
it would be possible to detect the errors in the example you gave at
compile time, your mention of exceptions leads me to believe that you
want runtime behavior.

Strong typing can be more clearly seen in something like haskell where
you can define a function

len [] = 0
len [ _ | A ]  = 1 + len A

the compile will automatically detect that the len function has the
signature "list of * -> int" and will then issue a compile time error
if you call len "foo".

Hope that helps to clarify things,
Matt


-- 
"Computer Science is merely the post-Turing Decline of Formal Systems Theory."
-???

Reply via email to