Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!postnews2.euro.net!news.wanadoo.nl!not-for-mail From: mhx@iae.nl (Marcel Hendrix) Subject: Re: OOP Newsgroups: comp.lang.forth Message-ID: <84621995948435@frunobulax.edu> Date: Sat, 8 Sep 2012 16:41:51 +0200 References: <504b37d4$0$294$14726298@news.sunsite.dk> X-Newsreader: iForth 2.0 console (October 21, 2006) Lines: 44 Organization: Wanadoo NNTP-Posting-Date: 08 Sep 2012 14:41:22 GMT NNTP-Posting-Host: s529d937f.adsl.wanadoo.nl X-Trace: 1347115282 dr4.euro.net 9202 82.157.147.127:50364 X-Complaints-To: abuse@wanadoo.nl Xref: csiph.com comp.lang.forth:15529 Doug Hoffman wrote Re: OOP packages > On 5/15/12 2:37 PM, Marcel Hendrix wrote: >> Doug Hoffman writes Re: OOP packages [..] > try replacing the one DEFER word with a value, then change the two other > definitions affected (changes in UPPER CASE): > 0 VALUE allotocate > : makeobj ( class -- o) pre-obj allotocate EXECUTE post-obj ; > : make ( xt -- o) TO allotocate ' >body state @ > if postpone literal postpone makeobj else makeobj then ; > This then compiled and ran fine for me on my version of iForth, no > extraneous stack items. Actually, only one change is necessary: iForth's compiled IS is written as [IS], like this: : make ( xt -- o) [is] allotocate ' >body state @ if postpone literal postpone makeobj else makeobj then ; The problem with the extra stack items was my test: it was based on insufficient understanding of your code. I should not have pasted the output of your posting verbatim. \ Original (wrong) test dict> var value x x .s init: \ ok cr x p: 5 \ ok \ New test dict> var value x x .s init: \ ok cr x p: \ 5 ok Sorry about that. Conclusion: This OOP package works on all major Forths with only a single cosmetic (is DEFER standard already?) change. -marcel