Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 1999 22:47:44 +0900
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        gnats-admin@FreeBSD.ORG, freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/9663: Getting builtin's parameters from the stack in loader
Message-ID:  <36ADC780.E45DEBD7@newsguy.com>
References:  <199901241250.EAA17381@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------0D5009DBFFB461D2A4D0D1A2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

As I reviewed the patch, I made some changes to the comments. Here
is the diffs for them.

gnats-admin@FreeBSD.ORG wrote:
> 
> Thank you very much for your problem report.
> It has the internal identification `bin/9663'.
> The individual assigned to look at your
> report is: freebsd-bugs.
> 
> >Category:       bin
> >Responsible:    freebsd-bugs
> >Synopsis:       Making builtin's state-aware in loader
> >Arrival-Date:   Sun Jan 24 04:50:01 PST 1999

--
Daniel C. Sobral			(8-DCS)
dcs@newsguy.com

	If you sell your soul to the Devil and all you get is an MCSE from
it, you haven't gotten market rate.
--------------0D5009DBFFB461D2A4D0D1A2
Content-Type: text/plain; charset=us-ascii;
 name="patch"
Content-Disposition: inline;
 filename="patch"
Content-Transfer-Encoding: 7bit

--- interp_forth.c	1999/01/24 12:28:08	1.11
+++ interp_forth.c	1999/01/26 12:44:42
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$Id: interp_forth.c,v 1.11 1999/01/24 12:28:08 root Exp root $
+ *	$Id: interp_forth.c,v 1.11 1999/01/24 12:28:08 root Exp $
  */
 
 #include <sys/param.h>		/* to pick up __FreeBSD_version */
@@ -152,18 +152,18 @@
  *          being interpreted.
  *
  * There is one major problem with builtins that cannot be overcome
- * in anyway, except by outlawing it, such as done below. We want
- * builtins to behave differently depending on whether they have been
- * compiled or they are being interpreted. Notice that this is *not*
- * the current state. For example:
+ * in anyway, except by outlawing it. We want builtins to behave
+ * differently depending on whether they have been compiled or they
+ * are being interpreted. Notice that this is *not* the interpreter's
+ * current state. For example:
  *
  * : example ls ; immediate
- * : problem example ;
- * example
+ * : problem example ;		\ "ls" gets executed while compiling
+ * example			\ "ls" gets executed while interpreting
  *
- * Notice that the current state is different in the two invocations
- * of "example", but, in both cases, "ls" has been *compiled in*, which
- * is what we really want.
+ * Notice that, though the current state is different in the two
+ * invocations of "example", in both cases "ls" has been
+ * *compiled in*, which is what we really want.
  *
  * The problem arises when you tick the builtin. For example:
  *
@@ -174,16 +174,37 @@
  *
  * We have no way, when we get EXECUTEd, of knowing what our behavior
  * should be. Thus, our only alternative is to "outlaw" this. See RFI
- * 0007, and ANS Forth Standard's appendix D, item 6.7.
+ * 0007, and ANS Forth Standard's appendix D, item 6.7 for a related
+ * problem, concerning compile semantics.
  *
- * The problem is compounded by the fact that ' builtin CATCH is valid
+ * The problem is compounded by the fact that "' builtin CATCH" is valid
  * and desirable. The only solution is to create an intermediary word.
  * For example:
  *
  * : my-ls ls ;
  * : example ['] my-ls catch ;
  *
- * As the this definition is particularly tricky, and it's side effects
+ * So, with the below implementation, here is a summary of the behavior
+ * of builtins:
+ *
+ * ls -l				\ "interpret" behavior, ie,
+ *					\ takes parameters from TIB
+ * : ex-1 s" -l" 1 ls ;			\ "compile" behavior, ie,
+ *					\ takes parameters from the stack
+ * : ex-2 ['] ls catch ; immediate	\ undefined behavior
+ * : ex-3 ['] ls catch ;		\ undefined behavior
+ * ex-2 ex-3				\ "interpret" behavior,
+ *					\ catch works
+ * : ex-4 ex-2 ;			\ "compile" behavior,
+ *					\ catch does not work
+ * : ex-5 ex-3 ; immediate		\ same as ex-2
+ * : ex-6 ex-3 ;			\ same as ex-3
+ * : ex-7 ['] ex-1 catch ;		\ "compile" behavior,
+ *					\ catch works
+ * : ex-8 postpone ls ;	immediate	\ same as ex-2
+ * : ex-9 postpone ls ;			\ same as ex-3
+ *
+ * As the definition below is particularly tricky, and it's side effects
  * must be well understood by those playing with it, I'll be heavy on
  * the comments.
  *

--------------0D5009DBFFB461D2A4D0D1A2--




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36ADC780.E45DEBD7>