On Sun, May 31, 2015 at 10:51 AM, Jonathan S. Shapiro <s...@eros-os.org> wrote:
> On Sat, May 30, 2015 at 5:46 PM, Matt Oliveri <atma...@gmail.com> wrote:
>>
>>
>> What it looked like you were doing to handle this was define all the
>> things you want to be types as mutually recursive types. I was
>> building on that by showing how you can still factor out the fields
>> that are common to all legs of all types.
>
> So first, many of these languages actually don't have a way to define
> mutually recursive types.

I don't believe you. :) The only popular language I know of that
doesn't effectively have mutually recursive types is SQL, which of
course doesn't have recursion at all.

(Untyped languages arguably don't have mutually recursive types, but
they can do all the same things as if they did.)

> Second, merely factoring out the common fields isn't the goal here. The goal
> is to do that in such a way that we end up with a type that can describe the
> kind of AST that is typically associated with a context-free grammar.

Right. I think that context-free-ness is what makes it possible, even
if it turns out to be too bulky or messy. With context-sensitive,
you'd need dependent types. (Or just GADTs, if you're lucky.)

> How about this:
>
> Pick a language of your choice. Show me how to declare the type of an AST
> node that satisfies the following properties:

Sounds good. I'll see what I can do.
_______________________________________________
bitc-dev mailing list
bitc-dev@coyotos.org
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to