You should look at Common Lisp. it's definition of "optional typing"
> is that if you take a correct program and remove all the type
> declarations, then it still works correctly, although it may be
> significantly less efficient. Larry and i have discussed this and that
> was his goai in Perl.

Wow, what is a correct program? I assume that there can be incorrect
type annotations then. I.e. if they introduce a type error that
wasn't there in the correct program before that it's the annotation's
fault, right?

Is this a correct implementation of Hello World?

    sub foo ($x)
        if $x == 13 { say "Hello World!" }


If yes, isn't it reasonable to annotate $x in foo with Int?
And would that produce a type error? IOW, is '13'.does(Int)
true? In nominal typing it should be false. But Str::ACCEPTS
could be a little smarter.

> Now Perl doesn't quite meet that because of
> inferred method dispatch on .new(). you need to change

Isn't it generally the case that assignment is
dispatched on the *static* type of the lhs? I surmise
that binding cannot be overloaded and this really is
where the type checker kicks in. But what exactly is
it supposed to do then?

I guess the generic answer is that there will be installable
pairs of dispatcher and binder. Which then raises the question
what the standard set will be :)

Regards, TSa.

"The unavoidable price of reliability is simplicity"
  -- C.A.R. Hoare

Reply via email to