Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #10738

Backquoted Macros

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin1!goblin.stu.neva.ru!nrc-news.nrc.ca!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From Helmar Wodtke <helmwo@gmail.com>
Newsgroups comp.lang.forth
Subject Backquoted Macros
Date Thu, 29 Mar 2012 08:29:04 -0700 (PDT)
Organization http://groups.google.com
Lines 31
Message-ID <21091167.276.1333034944725.JavaMail.geo-discussion-forums@yneo2> (permalink)
NNTP-Posting-Host 62.158.106.76
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Trace posting.google.com 1333036582 404 127.0.0.1 (29 Mar 2012 15:56:22 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Thu, 29 Mar 2012 15:56:22 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=62.158.106.76; posting-account=nibe3QoAAADcYL8fC0WC6vCas4By1Xgn
User-Agent G2/1.0
X-Received-Bytes 2101
Xref csiph.com comp.lang.forth:10738

Show key headers only | View raw


Hi,

I'm working on some documentation to my Forth system (forth4p) and came across the nice invention of "Backquoted Macros" from FreeForth again.

Does anyone else than FreeForth and my Forth use this?

It's very practical:

: 2dup` over` over` ;

could be a definition of 2dup. The backquote at colon-definition name means more or less the thing is "IMMEDIATE" and inside code it means more or less to "POSTPONE" the word. So similar thing in "Forth 94" would look like:

: 2dup postpone over postpone over ; immediate

The nice thing about it is that you see if a word is immediate right after colon. The other nice thing is that you have much less space consumed than to write "POSTPONE". Actually neither forth4p nor FreeForth use the quirky semantics of "POSTPONE" if it comes to STATE (FreeForth does not even have this if I remember right).

Maybe this concept is interesting for others - look at FreeForth page for the original: http://christophe.lavarenne.free.fr/ff/
HelFORTH and forth4p also implement a backquote in front of a word, which is similar (well, "about similar") to something like ['] name.


Regards,
-Helmar

Back to comp.lang.forth | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Backquoted Macros Helmar Wodtke <helmwo@gmail.com> - 2012-03-29 08:29 -0700
  Re: Backquoted Macros Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-04-03 09:33 +0000
    Re: Backquoted Macros Mark Wills <markrobertwills@yahoo.co.uk> - 2012-04-03 06:46 -0700
  Re: Backquoted Macros Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-04-03 03:32 -0700
  Re: Backquoted Macros BruceMcF <agila61@netscape.net> - 2012-04-03 17:02 -0700

csiph-web