Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Private Object Function

From: coussement:c:itc:mil:be at: 22-Jan-2001 8:57

> I was really in a hurry when I wrote this stuff. The class function I > included was untested and incorrect. The corrected version is: > > class: func [ default! [object!] spec [block!] ] [ > set [_ private-block _ published-block _ public-block] spec > return make default! [ > if private-block [private: make object! private-block] > if published-block [published: make object! published-block] > if public-block [public: make object! public-block] > ] > ] > > A better version is: > > class: func [[catch] default! [object!] spec [block!] /local > class-spec] [ > class-spec: make block! 6 > foreach [section definition] spec [ > either block? definition [ > insert class-spec compose/deep [ > (to set-word! section) make object! [(definition)] > ] > ][ > throw make error! join {Expected definition of type block!. > Received } [mold definition " of type " mold type? definition " > instead."] > ] > ] > return make default! class-spec > ] > > The second version is more flexible in that it permits spec blocks that > exclude any or all of the exposure signifiers (public, published, or > private), the declarations may occur in any order, and it catches > incorrect definitions. > > Hope this helps,
[Thanks, Elan, for this contribution. I will try to publish on a regular base the results I get. I will try to find a way to bypass the standard REBOL inheritence mechanism so I can implement private functions. BTW, I went to your site this sunday. Great look ! I like the letter type you use ;-) Kind Regards, chr== ]