Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail From: Lars Brinkhoff Newsgroups: comp.lang.forth Subject: Re: Would ?EXIT work in all ANS-Forth systems? Organization: nocrew References: <13e6c647-fd9a-4d77-89e3-2cc977f3bd5b@googlegroups.com> <1cca60ee-6f98-443d-8466-d7efbea8724f@googlegroups.com> <_6OdnQW2rOImdIXEnZ2dnUU7-IvNnZ2d@supernews.com> Date: Mon, 15 May 2017 07:11:19 +0200 Message-ID: <86mvae66x4.fsf@molnjunk.nocrew.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:ZeiayBb+jAjdJyM1XiYbhQqhHs4= MIME-Version: 1.0 Content-Type: text/plain Lines: 27 NNTP-Posting-Host: 178.18.91.250 X-Trace: news.sunsite.dk DXC=K6Ik[lUjHo>dWg;6EL\fA6YSB=nbEKnk;:02ZWQ`i[j4nY:6X7^ZBN7I57e>YZ9SO;1HBfORCSCc3D5J_h8H;EF3I2Ic:1WDKB3 X-Complaints-To: staff@sunsite.dk Xref: csiph.com comp.lang.forth:59247 Andrew Haley wrote: >>>> : ?# ( ud -- ud ) # 2dup d0= if r> drop then ; >>>> : #,S ( ud -- 0 0 ) begin ?# ?# ?# [char] , hold again ; >>> >>> I hope that wouldn't pass review. > >> What matter is idea behind code. User will modify '?#' definition >> accordingly with used Forth implementation, if necessary, or choose >> another Forth implementation. > > : ?# ( ud -- ud' t ) # 2dup or ; > : #,S ( ud -- 0 0 ) > begin > ?# while ?# while ?# while > [char] , hold > repeat then then ; > > So, not quite as cute, but it does the job. And the reader can see > where the exits are. What advantage did the return stack, er, > technique :-) bring you? I'm reminded of Sam Falvo's 2010 article "The Declarative, Imperative, then Inquisitive Pattern" https://sam-falvo.github.io/2010/02/27/declarative-imperative-then-inquisitive It does use return stack tricks quite heavily.