[Grace-core] [A Graceful Blog] Comment: "From Lancaster to Portland"
James Noble
kjx at ecs.vuw.ac.nz
Mon Oct 10 04:48:31 PDT 2011
Hi John and all
swinging around to this again.
(even hoping to consolidate a batch of spec changes tomorrow)
> I don't think Dynamic would be like Scala's None; much more likely that
> it is treated like Any, except possibly that a cast will be implicit
> when going to typed code.
yes - and when making a message call on dynamic.
This is the model of C# & VB at least;
In VB, the type is Object, and there is a compiler switch to say
whether or not any message is permitted to be sent to something of type Object...
> ] Of course, if one wrote the "obvious" code
> ]
> ] SPointType2 = {x: Number; y: Number; = (SPointType2) -> Boolean}
> GPointType2 = { x : Dynamic; y : Dynamic; = (Dynamic) -> Dynamic }
>
> Then GPointType2 is considered a subtype of SPointType2 ?
yep.
But as Michael & others have pointed out - this really needs a dynamic
wrapper to be generated to be sure of being safe.
I assume this is what Atsushi does with his Gradual Generics "banana casts"
and also that the typed-racket people do this too.
Whenever you're casting down from Dynamic (aka Object aka Any)
you have to do something.
I *think* C# requires an explicit cast - but I'm not sure...
> But I guess before we get any deeper, we have to find out how people
> intend "Dynamic" to work in Grace.
indeed!
The C# 3.0 paper; Atsushi's OOPSLA paper this year & the typed scheme
stuff seems the most relevant. Things like Strongtalk & Typed Ruby
well they are *optional* type systems - but that's different from a type
system that supports gradual typing / type dynamic.
Andrew is keen for Grace's type system to be both optional & gradual.
I now think Thorn's like types - always dynamically checked but
restrict programs statically to methods of their declared type - are
another approach to this...
James
More information about the Grace-core
mailing list