9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Noah Evans <noah.evans@cwru.edu>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] multiple inputs
Date: Thu,  1 Apr 2004 10:58:05 -0500	[thread overview]
Message-ID: <4480b39f295c1bb285304c4b2e0f9261@cwru.edu> (raw)
In-Reply-To: <8cdad86de9428072d82f8764a903f798@vitanuova.com>

[-- Attachment #1: Type: text/plain, Size: 744 bytes --]

I think the idea of the hygenic macro is to implement the macro facility in to the compiler as a change to the parse tree rather than a change to the program text with a preprocessor(sorry if I'm being painfully obvious here).

This means that your macros don't have the normal problems associated with macros(precedence problems, multiple evaluation of arguments etc.). I haven't put very much thought into this, but from I'm guessing an implementation would act like a simplified yacc that worked with the compiler directly.

Again I'm not sure how practical this would be. The only implementation I know of, in scheme, is aided by scheme's use of prefix notation. Figuring out the precedence order would be a pain.

Thoughts?

Noah

[-- Attachment #2: Type: message/rfc822, Size: 3411 bytes --]

From: rog@vitanuova.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] multiple inputs
Date: Thu, 01 Apr 2004 18:36:36 +0100
Message-ID: <8cdad86de9428072d82f8764a903f798@vitanuova.com>

> which is much clearer and doesn't require us to wade through
> custom macro syntax.

i sympathise completely.

problem is the moment you have something that's flexible enough
to allow alt, you'll get someone that wants to do all kinds of other
things with it. remember:

LOCAL TREPTR	list(flg)
{
	REG TREPTR	r;
	REG INT		b;

	r = term(flg);
	WHILE r ANDF ((b=(wdval==ANDFSYM)) ORF wdval==ORFSYM)
	DO	r = makelist((b ? TAND : TORF), r, term(NLFLG));
	OD
	return(r);
}

what you're after, i think, is a different language, one with one or
two extra features, not really a way to customise C in an arbitrary
way.  a pre-processor could do the job, but you'd pay the price.

if many people defined syntax like the alt stuff, you'd really struggle
to work out what was going on. IMHO a language requires a small,
coherently designed set of features, not a way to add every feature
under the sun.

  reply	other threads:[~2004-04-01 15:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-30  6:53 npe
2004-03-30  8:22 ` matt
2004-03-30 11:48   ` glenda
2004-03-30 14:03     ` matt
2004-03-30 12:10       ` glenda
2004-03-30 16:07         ` rog
2004-03-30 14:15           ` Noah Evans
2004-03-30 16:25         ` rog
2004-03-30 16:14           ` Noah Evans
2004-03-30 18:27             ` rog
2004-03-30 16:28               ` Noah Evans
2004-03-31 20:22             ` boyd, rounin
2004-04-01 13:01               ` Noah Evans
2004-04-01 15:31                 ` rog
2004-04-01 14:43                   ` boyd, rounin
2004-04-01 16:26                   ` Russ Cox
2004-04-01 17:36                     ` rog
2004-04-01 15:58                       ` Noah Evans [this message]
2004-04-01 18:42                         ` rog
2004-04-01 17:34                           ` Noah Evans
2004-04-01 19:47                             ` rog
2004-04-01 18:02                               ` Noah Evans
2004-04-02  1:48                                 ` Geoff Collyer
2004-04-01 20:04                             ` David Tolpin
2004-04-02  1:46                     ` Geoff Collyer
2004-04-02  2:09 Noah Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4480b39f295c1bb285304c4b2e0f9261@cwru.edu \
    --to=noah.evans@cwru.edu \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).