[Grace-core] Grace feedback

Dan Grossman djg at cs.washington.edu
Mon Nov 8 09:00:06 PST 2010


On Mon, Nov 8, 2010 at 12:46 AM, James Noble <kjx at ecs.vuw.ac.nz> wrote:
>> However, I don't know how to do ADTs without types.  ADTs fundamentally
>> need types to achieve the encapsulation
>
> sure - but these could be static types or dynamic types...

Agreed.  For the dynamic approach, see for example define-struct and
units in PLTScheme/Racket.  The former creates a new dynamic type
(e.g., foo) at run-time and provides a constructor that creates things
whose contents (and types) can be accessed only via the new selectors
(and type predicate) introduced by the define-struct.  Then the latter
allows these selectors and predicates to be unavailable outside an ADT
implementation's scope.  No static types needed anywhere.

--Dan


More information about the Grace-core mailing list