Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: DISFAVORED ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 62 of 89 Topic 3800 of 4288
Post > Topic >>

Re: DISFAVORED Was: name for 3 PICK finally?

by Jonah Thomas <jethomas5@[EMAIL PROTECTED] > Mar 8, 2008 at 07:02 PM

Bruce McFarling <agila61@[EMAIL PROTECTED]
> wrote:
> Jonah Thomas <jethom...@[EMAIL PROTECTED]
> wrote:
> > Yes. But what about transparency? The late-bound macro is easy to
> > understand. It does the same thing you'd get from EVALUATEing the
> > macro string later. It might not do what you'd most want it to, but
> > it's easy to see what it will do. Early-binding macro might be easy
> > to follow too. Choosing between them is less easy. Providing a way
> > to do either one and explaining the difference.... I dunno.
> 
> On the simple early binding macro ``[:] name macro_code [;]'',
> complexity is reduced by reducing the phases of execution to keep
> track of ... inside [ ... ] happens as you define the macro, and
> outside happens when the word containing the macro executes. The lack
> of flexibility (no way to modify what happens at macro run-time) is
> also lack of complexity.

It takes complexity to save xt's etc into a compiler macro. This is
system complexity.

To do it with standard code (as opposed to something efficient you do
under-the-hood), you'd wind up with something like:

.... xt LITERAL COMPILE, xt LITERAL COMPILE, xt LITERAL EXECUTE xt
LITERAL COMPILE, ....

And to make that code you'd probably want to use POSTPONE IMMEDIATE etc.
A lot of system complexity that could be left out. But that system
complexity doesn't bother users, much, right? No, sometimes it does.
Apart from users who make state-smart words, we get problems with
parsing words. these typically parse a string and do something to get a
result, then they compile the result so that at a later time pointers to
the result go onto the data stack. S" compiles a string literal and
later an address-and-count appear on the stack. ['] compiles an xt like
a literal and later the xt goes on the stack. Etc. The result is, when
you try to do something complicated about building a custom parsing word
out of existing parsing words, it's easy to get mixed up about when the
parsing happens and when the stuff is left on the stack. The deeper the
parsing words get embedded inside new parsing words, the easier it is to
get all that mixed up. The easiest way to avoid confusion is don't make
complex parsing words. The second-easiest way is to build your words a
layer at a time and test them at each step.

Still, it's easy to get into complications, and those complications are
automatically avoided if you leave out the complexities you get when you
sometimes compile immediate words. 

> The definition of MACRO due to Wil Baden is short enough that it shows
> that if you provide EVALUATE, you provide a late binding MACRO.

Exactly. It's extremely simple. And it does a lot of what you need,
without the complexity we're used to. But does it do enough of the job?
 
> > Still, you *could* have early-bound macros. They'd use methods that
> > I hope wouldn't be available to users, so that Forth would have an
> > extra layer of mystery, something extra beyond DOES> etc.
> 
> > I think you can get by with only late-binding macros, but it give
> > you limitations.
> 
> In a small free standing system where you might wish to be able to
> strip out headers, early-binding macros are the way to go. And if its
> got EVALUATE, a late binding ``macro:'' can always be loaded if
> desired.

If you want to strip out headers after all the compilation has been
done, then late-binding macros shouldn't cause a problem. If there are
no "special" words like IF THEN ." etc in the macro, then it doesn't
need to be a macro at all. Compile normal Forth words into a normal
definition and you won't miss the dictionary. So I don't think this will
usually be a problem.
 
> Like I said, ``[:] name macro_code [;]'' is not completely general,
> and in particular if you want to do a conditional at macro run-time,
> you have to fall back to POSTPONE. I normally don't want to do that,
> as it risks extending STATE dependency into a whole family of user-
> defined compiler state variable.

Yes. But simple text macros give you the problem that you might redefine
names that are used in them. That shouldn't be a problem for standard
words. If you redefine IF then it's your responsibility to watch out for
macros that use IF . But in large systems you don't know what might get
redefined by code you run without inspecting, and you don't know how the
search order might ge redefined. Anton and I think one or more others
pointed out problems with that.


OK, text macros are dead simple, but they don't fill enough of the need.
 




 89 Posts in Topic:
name for 3 PICK finally?
m_l_g3@[EMAIL PROTECTED]   2008-03-05 11:11:00 
Re: name for 3 PICK finally?
Elizabeth D Rather <er  2008-03-05 10:23:12 
Re: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-05 12:45:31 
Re: name for 3 PICK finally?
m_l_g3@[EMAIL PROTECTED]   2008-03-06 04:08:32 
Re: name for 3 PICK finally?
Andrew Haley <andrew29  2008-03-06 12:51:52 
Re: name for 3 PICK finally?
Jerry Avins <jya@[EMAI  2008-03-06 10:12:36 
Re: name for 3 PICK finally?
Coos Haak <chforth@[EM  2008-03-06 21:07:02 
Re: name for 3 PICK finally?
mhx@[EMAIL PROTECTED] (M  2008-03-06 21:17:29 
Re: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-06 13:59:21 
Re: name for 3 PICK finally?
Jerry Avins <jya@[EMAI  2008-03-06 15:28:37 
Re: name for 3 PICK finally?
Albert van der Horst <  2008-03-06 15:39:29 
Re: name for 3 PICK finally?
Alex McDonald <blog@[E  2008-03-06 07:01:21 
Re: name for 3 PICK finally?
mhx@[EMAIL PROTECTED] (M  2008-03-06 21:04:51 
Re: name for 3 PICK finally?
Alex McDonald <blog@[E  2008-03-06 14:19:30 
Re: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-06 08:22:06 
Re: name for 3 PICK finally?
Jonah Thomas <jethomas  2008-03-06 17:04:23 
Re: name for 3 PICK finally?
Andrew Haley <andrew29  2008-03-07 11:09:43 
Re: name for 3 PICK finally?
Jonah Thomas <jethomas  2008-03-07 06:43:26 
Re: name for 3 PICK finally?
Andrew Haley <andrew29  2008-03-07 12:19:56 
Disfavoured words (Re: name for 3 PICK finally?)
anton@[EMAIL PROTECTED]   2008-03-08 18:51:57 
DISFAVORED Was: name for 3 PICK finally?
Jonah Thomas <jethomas  2008-03-07 09:13:33 
Re: DISFAVORED Was: name for 3 PICK finally?
Andrew Haley <andrew29  2008-03-07 14:26:52 
Re: DISFAVORED Was: name for 3 PICK finally?
pablo reda <pabloreda@  2008-03-07 06:33:40 
Re: DISFAVORED Was: name for 3 PICK finally?
Jonah Thomas <jethomas  2008-03-07 10:02:23 
Re: DISFAVORED Was: name for 3 PICK finally?
Andrew Haley <andrew29  2008-03-10 16:15:16 
Re: DISFAVORED Was: name for 3 PICK finally?
Elizabeth D Rather <er  2008-03-10 07:58:59 
Re: DISFAVORED Was: name for 3 PICK finally?
"Mark W. Humphries&q  2008-03-07 07:46:25 
Re: DISFAVORED Was: name for 3 PICK finally?
Andrew Haley <andrew29  2008-03-10 16:15:52 
Re: DISFAVORED Was: name for 3 PICK finally?
Alex McDonald <blog@[E  2008-03-07 08:10:40 
Re: DISFAVORED Was: name for 3 PICK finally?
Bill <bill@[EMAIL PROT  2008-03-07 13:22:10 
Re: DISFAVORED Was: name for 3 PICK finally?
"Mark W. Humphries&q  2008-03-07 08:26:20 
Re: DISFAVORED Was: name for 3 PICK finally?
Jonah Thomas <jethomas  2008-03-07 11:51:07 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-07 09:08:12 
Re: DISFAVORED Was: name for 3 PICK finally?
Elizabeth D Rather <er  2008-03-07 07:56:23 
Re: DISFAVORED Was: name for 3 PICK finally?
John Doty <jpd@[EMAIL   2008-03-07 15:12:12 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-07 09:11:02 
Re: DISFAVORED Was: name for 3 PICK finally?
"Mark W. Humphries&q  2008-03-07 09:37:07 
Re: DISFAVORED Was: name for 3 PICK finally?
Jonah Thomas <jethomas  2008-03-07 13:06:51 
Re: DISFAVORED Was: name for 3 PICK finally?
Alex McDonald <blog@[E  2008-03-07 14:09:52 
Re: DISFAVORED Was: name for 3 PICK finally?
John Doty <jpd@[EMAIL   2008-03-07 15:14:31 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-07 14:51:48 
Re: DISFAVORED Was: name for 3 PICK finally?
Alex McDonald <blog@[E  2008-03-07 15:08:55 
Re: DISFAVORED Was: name for 3 PICK finally?
John Doty <jpd@[EMAIL   2008-03-07 16:28:56 
Re: DISFAVORED Was: name for 3 PICK finally?
Jonah Thomas <jethomas  2008-03-07 18:15:57 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-07 16:06:19 
Re: DISFAVORED Was: name for 3 PICK finally?
Alex McDonald <blog@[E  2008-03-07 16:06:16 
Re: DISFAVORED Was: name for 3 PICK finally?
John Doty <jpd@[EMAIL   2008-03-07 17:23:37 
Re: DISFAVORED Was: name for 3 PICK finally?
Josh Grams <josh@[EMAI  2008-03-07 16:54:26 
Re: DISFAVORED Was: name for 3 PICK finally?
Jonah Thomas <jethomas  2008-03-07 20:54:07 
Re: DISFAVORED Was: name for 3 PICK finally?
Jonah Thomas <jethomas  2008-03-07 21:01:01 
Re: DISFAVORED Was: name for 3 PICK finally?
anton@[EMAIL PROTECTED]   2008-03-08 18:40:59 
Re: DISFAVORED Was: name for 3 PICK finally?
"Mark W. Humphries&q  2008-03-07 19:34:51 
Re: DISFAVORED Was: name for 3 PICK finally?
"Mark W. Humphries&q  2008-03-07 22:02:11 
Re: DISFAVORED Was: name for 3 PICK finally?
"Mark W. Humphries&q  2008-03-07 22:12:15 
Re: DISFAVORED Was: name for 3 PICK finally?
"Mark W. Humphries&q  2008-03-07 22:24:45 
Re: Late vs. early binding Was: DISFAVORED Was: name for 3 PICK
Josh Grams <josh@[EMAI  2008-03-08 05:14:24 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-08 09:37:41 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-08 09:53:39 
Re: Late vs. early binding Was: DISFAVORED Was: name for 3 PICK
Bruce McFarling <agila  2008-03-08 09:56:51 
Re: DISFAVORED Was: name for 3 PICK finally?
"Mark W. Humphries&q  2008-03-08 12:11:07 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-08 13:19:05 
Re: DISFAVORED Was: name for 3 PICK finally?
Jonah Thomas <jethomas  2008-03-08 19:02:05 
Re: DISFAVORED Was: name for 3 PICK finally?
Albert van der Horst <  2008-03-09 14:16:23 
Re: DISFAVORED Was: name for 3 PICK finally?
mhx@[EMAIL PROTECTED] (M  2008-03-09 17:25:23 
Re: DISFAVORED Was: name for 3 PICK finally?
Albert van der Horst <  2008-03-09 20:23:38 
Re: DISFAVORED Was: name for 3 PICK finally?
Jerry Avins <jya@[EMAI  2008-03-09 17:54:51 
Re: DISFAVORED Was: name for 3 PICK finally?
Coos Haak <chforth@[EM  2008-03-10 00:59:40 
Re: DISFAVORED Was: name for 3 PICK finally?
Jerry Avins <jya@[EMAI  2008-03-09 21:22:30 
Re: DISFAVORED Was: name for 3 PICK finally?
Albert van der Horst <  2008-03-10 14:12:08 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-09 20:28:55 
Re: DISFAVORED Was: name for 3 PICK finally?
Jerry Avins <jya@[EMAI  2008-03-09 23:42:12 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-09 22:26:59 
Re: DISFAVORED Was: name for 3 PICK finally?
Albert van der Horst <  2008-03-10 14:23:28 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-10 13:48:58 
Re: DISFAVORED Was: name for 3 PICK finally?
Albert van der Horst <  2008-03-11 09:41:41 
Re: DISFAVORED Was: name for 3 PICK finally?
Coos Haak <chforth@[EM  2008-03-11 18:14:25 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-11 10:56:10 
Macros etc Was: DISFAVORED
Jonah Thomas <jethomas  2008-03-08 23:56:25 
Re: Macros etc Was: DISFAVORED
Andrew Haley <andrew29  2008-03-10 16:30:20 
Re: Macros etc Was: DISFAVORED
Albert van der Horst <  2008-03-11 10:15:46 
Re: Macros etc Was: DISFAVORED
Andrew Haley <andrew29  2008-03-11 10:23:50 
Re: Macros etc Was: DISFAVORED
"Mark W. Humphries&q  2008-03-08 22:01:52 
Re: name for 3 PICK finally?
gavino <gavcomedy@[EMA  2008-03-09 03:50:29 
Re: DISFAVORED Was: name for 3 PICK finally?
"Mark W. Humphries&q  2008-03-09 07:19:05 
Re: Macros etc Was: DISFAVORED
Jonah Thomas <jethomas  2008-03-09 11:08:35 
Re: DISFAVORED Was: name for 3 PICK finally?
Jonah Thomas <jethomas  2008-03-09 11:40:37 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-09 15:39:37 
Re: Macros etc Was: DISFAVORED
"Mark W. Humphries&q  2008-03-09 19:49:30 
Re: DISFAVORED Was: name for 3 PICK finally?
Bruce McFarling <agila  2008-03-09 20:17:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 8:24:58 CDT 2008.