TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:

I found two dissertations and a couple of papers about typing
JavaScript. The quintessential is that optional typing is
defined as having *no* impact on the dynamic behavior of the
program. In that respect type annotations are like comments.
I doubt that this is the case with Perl 6, or is it?

Regards, TSa.

In Perl 6, I'm trying to identify where type annotations affect behavior and when they don't. I think that's important since it separates the must-do analysis from optional optimization, and conversely describes what the optimizer can't do even if it thinks it could.

As a degenerate case, not being allowed to assign or bind something is certainly an impact on behavior.

If MMD is based on actual dynamic types, then static types don't affect the result, other than to prevent the program from loading the wrong thing into a variable that then gets used as a parameter.
Also, look at:
my Dog $spot .= new("Fido");

the static type Dog does affect the subsequent use of .new. Even if you explain that in terms of the protoobject, the point is that saying Dog =does= something, it's not just a comment like a (current) Javascript naming convention.


Reply via email to