Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!postnews2.euro.net!news.wanadoo.nl!not-for-mail From: mhx@iae.nl (Marcel Hendrix) Subject: Re: Forth as a polarising language Newsgroups: comp.lang.forth Message-ID: <94891995948435@frunobulax.edu> Date: Sat, 8 Sep 2012 16:14:09 +0200 References: <504b26cb$0$286$14726298@news.sunsite.dk> X-Newsreader: iForth 2.0 console (October 21, 2006) Lines: 44 Organization: Wanadoo NNTP-Posting-Date: 08 Sep 2012 14:13:39 GMT NNTP-Posting-Host: s529d937f.adsl.wanadoo.nl X-Trace: 1347113619 dr2.euro.net 241 82.157.147.127:50358 X-Complaints-To: abuse@wanadoo.nl Xref: csiph.com comp.lang.forth:15527 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