Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!ENG.SUN.COM!wmb From: wmb@ENG.SUN.COM Newsgroups: comp.lang.forth Subject: Re: ANS Forth Message-ID: <9104062328.AA28713@ucbvax.Berkeley.EDU> Date: 5 Apr 91 19:58:17 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: wmb%ENG.SUN.COM@SCFVM.GSFC.NASA.GOV Organization: The Internet Lines: 29 > : DEFER CREATE 1 CELLS ALLOT DOES> @ EXECUTE ( PERFORM if it exists) ; > > Is the above line correct by BASIS 15? Yes. A slightly better definition would be: : COMPLAIN ." Unitialized DEFER word" cr ; : DEFER CREATE ['] COMPLAIN , DOES> @ EXECUTE ; > Can it use TO? No. There is no standard way to tell an existing system implementation of TO how to recognize children of the new defining word "DEFER", and what to do when they are recognized. Of course, you could pick another name (e.g. IS) and use it to set the value of DEFER words and nothing else. I suppose you could get fancy and do something like: : DEFER CREATE ['] COMPLAIN , 1234 1234 NOT 2, DOES> @ EXECUTE ; : TO \ name ( value -- ) ( Save the input stream pointer, look at the parameter field of ) ( "name" to see if it has 1234 1234 NOT in the right place, and ) ( if so, set the value. Otherwise restore the input stream pointer ) ( and execute the previous definition of TO . ) ; Mitch Bradley, wmb@Eng.Sun.COM