[Grace-core] Dialect encoding

Kim Bruce kim at cs.pomona.edu
Mon Jul 30 16:08:59 PDT 2012


I've read through all 5 messages, but I'm afraid that I don't understand how this encoding works.  Can you help me?

I agree it would be nice if we could encode dialect as something already in the language, but I won't feel terrible if we have to add it as a specialization of inheritance ("inherits public").

Kim



On Jul 29, 2012, at 6:55 PM, Timothy Jones wrote:

> I wanted to be clear on what it was that declaring the use of a dialect
> actually did, so I drew up an object encoding for it that acts the way I
> expect dialects to work: introducing the methods on the object into the
> local scope, but not attaching them to the self object (which is how it
> differs from using inherits). This behaviour can be achieved by
> attaching the methods to outer instead.
> 
> So this code in a module:
> 
> dialect myDialect
> hello
> 
> becomes:
> 
> object {
>    inherits myDialect
>    method newModule {
>        object {
>            hello
>        }
>    }
> }.newModule
> 
> A module that doesn't declare a dialect could be encoded in the same
> way, just with the outer object inheriting from the prelude rather than
> an explicit object.
> 
> The encoded program works in Minigrace. It calls the hello method
> defined in myDialect when run, and attempting to invoke hello on the
> module object itself fails.
> 
> Have I interpreted what a dialect is supposed to achieve correctly?
> 
> Tim
> 
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core



More information about the Grace-core mailing list