[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rather, DSSLs increase modularity, productivity



Christopher, my question is not so much to explore the theoretical
value of Curl's system.  But theory *is* useful because it helps us
understand things better.  I've been trying to understand Curl's type
system for a while now and I must admit, it's hard to form a model of
it.  I wonder if in fact the type system really is *defined* by the
compiler, as in, "if the compiler's combination of algorithms can
establish this type, then the expression has this type" -- where the
set of algorithms can change next week.

Re. my example, you made a claim about type checking that either (i) I
don't understand or (ii) seems to have been false.  In the short
snippet I gave you, there is a type-annotated variable that (a) can
flag errors at run-time only, and (b) requires checks at run-time.  As
I understand it, this clearly runs counter to your initial claims.
Ergo, the two options I see are (i) and (ii).

> Curl's type system is probably not all that interesting from a 
> theoretical standpoint but it does allow the programmer to choose 
> between dynamic and static programming styles as they see fit.

Again, I've heard this claim repeatedly now, and I still can't quite
tell what it means.  Perhaps you could tell us how Curl provides this
choice in an *interesting* way?  I thought it might be because the
compiler's smarts meant once a check was performed once in a body, it
flowed through to other values in the body.  But your own example
rejects that possibility:

>      {define-class A}
>      {define-class B {inherits A} {method {b}}}
>       let x:A = {B}
>       let y = x
>       {y.b} || ok
>       {x.b} || error, no member 'b' defined in 'A'

Even though x has a type annotation, and x clearly flows to y, y does
not inherit the type annotation.  That seems really strange.  You (and
other Curl people) have said that Curl "infers" types in a few
specialized cases (and I do recall some examples of it over local
scopes back when I tried out Curl), but this is about as natural a
case as any that I could imagine!  This would have been an at least
mildly interesting case of providing this choice.

Shriram