Path: ...!news.mixmin.net!aioe.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.lang.forth Subject: CREATE...DOES> etc. and flash (was: Dictionary separated ...) Date: Thu, 28 Jul 2016 09:17:00 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 82 Message-ID: <2016Jul28.111700@mips.complang.tuwien.ac.at> References: <3d8511c7-8cbf-4ef5-bdc3-eb33c5399d42@googlegroups.com> <8c63b476-e4fb-491e-a69a-873b51e3d02a@googlegroups.com> <04KdnWxKbtCzUgjKnZ2dnUU7-RPNnZ2d@supernews.com> Injection-Info: mx02.eternal-september.org; posting-host="d47d3421039fe8026514328ad0ebacae"; logging-data="21204"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yU5p1F+trXAZZmhz6qGuo" X-newsreader: xrn 10.00-beta-3 Cancel-Lock: sha1:hPOXtcswa0yCwCrS622qqYMvGS8= Bytes: 4277 "Elizabeth D. Rather" writes: >On 7/27/16 3:08 AM, HAA wrote: >> Elizabeth D. Rather wrote: >>> Historical note: ;: was Chuck's original name for the structure which >>> for many years now has been CREATE DOES> (by separating the creation >>> from the instance behaviors you get more flexibility). .... >I don't really remember the details, but as I recall it didn't have the >separate CREATE step, That's interesting, because I have been thinking about how to deal with the problem that Forth systems compiling to flash have difficulties with CREATE...DOES>, because DOES> overwrites a field that ideally would lie in flash (and which we don't want to overwrite). With the existence of quotations, a way to do this would be to replace : foo create code1 does> code2 ; with : foo [: code2 ;] -using foo example above it would be: : foo [: code2 ;] next-does create code1 ; For an optimizing 2DUP it would be :noname drop postpone over postpone over ; next-optimizer : 2dup over over ; And then one could combine several of these setup words. E.g., for defining : : +field ( n1 n2 "name" -- n3 ) [: @ + ;] next-does [: >body @ ?dup if postpone literal postpone + then ;] next-optimizer create over , + ; - anton -- M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html New standard: http://www.forth200x.org/forth200x.html EuroForth 2016: http://www.euroforth.org/ef16/