Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Alexander Skobelev Newsgroups: comp.lang.forth Subject: Re: FORTH on the Advanced Placement Computer Science ! Date: Sat, 10 Jan 2015 14:35:56 +0300 Organization: A noiseless patient Spider Lines: 47 Message-ID: References: <7x1tnngqt9.fsf@ruckus.brouhaha.com> <20141226022222.6f32fe7f@maxa-pc> <7xd277yybp.fsf@ruckus.brouhaha.com> <7xbnmquimp.fsf@ruckus.brouhaha.com> <3d03e403-7181-4ab3-8a2f-a23d0c4843f7@googlegroups.com> <87y4pt4qkl.fsf@jester.gateway.sonic.net> <2014Dec27.111715@mips.complang.tuwien.ac.at> <878uhs4zxk.fsf@jester.gateway.sonic.net> <871tnd9dg0.fsf@jester.gateway.pace.com> <87387q5hi8.fsf@jester.gateway.sonic.net> <43c6114f-8d41-4005-9131-fe93ec3d3696@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="9c0b930d8ac4a57f81167d1a74f8f538"; logging-data="4240"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ztS56UGcX3y3tPqqPKB18" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (darwin) Cancel-Lock: sha1:m+dfYiMLhUkyC+VQXDcQjWqG3sQ= sha1:ceZDpomPEA02wJW3y9xIA546BI8= Xref: csiph.com comp.lang.forth:35698 "Elizabeth D. Rather" writes: > On 1/9/15 3:25 AM, Alexander Skobelev wrote: >> "Elizabeth D. Rather" writes: >> >>> On 1/8/15 7:04 PM, Alexander Skobelev wrote: >>>> hughaguilar96@gmail.com writes: >>>> >>>>> The ANS-Forth standard doesn't support the use of C" and S" in >>>>> interpretive mode, and SwiftForth and Gforth both fail at this. I >>>>> fixed the problem in my novice package --- this is really necessary to >>>>> interactively debug functions that take strings as arguments. >>>>> >>>> >>>> Perhaps you have meant C" only, as S" in interpretive mode seems to be >>>> Gforth as well as ANS-Forth in FILE word set (see 11.6.1.2165). >>> >>> C" is actually not used very much nowadays, AFAIK. It was retained in >>> Forth94 because at the time some people used it, but I think counted >>> strings are used much less nowadays. >> >> I think they still can be useful for storing short strings in structure >> fields with a fixed width. >> >> Something like in this: >> 0 >> 22 CHARS +FIELD person.name >> ... >> CONSTANT Person >> >> , – where the person.name field is supposed to store a counted string of >> no more than 21 characters length. > > Oh, counted strings are wonderful! IMO they are the preferred way to > store strings internally, for many reasons. The vast majority of > internal strings work with an 8-bit count. But for some years we have > been gravitating toward using addr-cnt pairs for passing references to > strings on the stack. In our implementation, S" stores its string as a > counted string, likewise names and other strings, but we pass addr-cnt > on the stack. That is why C" (which passes the address of a counted > string) is not often used and there was no pressure to make an > interpretive version. > This is interesting. But that means that either your implementation the S" strings limited to 256 characters or you should use some tricks in the counted strings to store more characters there.