Re: [stack] Cat 0.14 Release

"Christopher Diggins" <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
On 5/22/07, William Tanksley, Jr <[email protected]> wrote:
> Christopher Diggins <[email protected]> wrote:
> > Major New Features:
> > - There is now a macro rewriting system (
> > http://code.google.com/p/cat-language/wiki/Macros ) called MetaCat
> > based on Manfred von Thun's paper "A Rewriting System for Joy". This
> > system can be used for optimization and to express the semantics of
> > the rest of the Cat language.
>
> Impressive.

Thank you. :-)

> Can macros be typechecked?

How were you thinking? I plan to add the feature later on that value
variables can have type restrictions, like:

macro { $a:int $a:int add } => { $a $a add_int }

For now there isn't such features.

> Can guards be set to conditionally allow or
> disallow the expansion of macros?

No, but that would be a good idea.

> Are macros specifically checked for
> identity, is it assumed, or can macros cause wildly different results?

The macros are assumed to be compatible with the langauge semantics.
If MetaCat matures later on then it could be concievable that MetaCat
actually defines the operational semantics of the language, which
would be trluy mind-blowing, but not outsiode of the realm of
possibility. Alan Kay I believe is working on something similar.

> Can a macro cause type-conformant code to be non-conformant?

Yep.

> I see that it's implementation-dependant whether a macro is allowed to
> reduce code. I think that makes sense, but I think that should
> probably be formalized a bit,

I agree.

> and control over whether a macro reduces
> code that it matches be given over to the programmer (possibly with a
> simple rule to prevent huge delays). But that's a HUGE project,
> obviously.

It might not be too bad, if I add namespaces, macro prioritization,
and macro expansion directives. I can imagine a simple import
directive inside of a namespace, that brings macro rules in to bear on
a specific scope (e.g. curly brace blocks), and other directives that
allow control.

The big challenge is to do such things elegantly. The notion of
namespaces is something that I have been playing with for a while and
have somewhat prepared in the code-base.

Thanks for the feeback.

Cheers,
Christopher
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.