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

[REBOL] Re: Private words in objects?

From: alberto:origen:mx at: 5-Jul-2006 11:35

Hi Ladislav,
>> >> > For protected variables see the PROTECT function. > > -Ladislav >
Yes, you are right. But you didn't understand my question, but was MY FAULT because I mixed terminology used in oop with terminology used in rebol programing. Sorry for That. When I said "protected" variables I mean: (using oop terminology) a property that is read-only for the "client" (normal code), but is read/write for methods (code inside the class/object) If I could write it in rebol (hypothetical code) would be: obj: make object! [ field: 0 protect-this 'field ;; **** NOT REBOL CODE: pretect only for client inc-field: func [][field: field + 1] ] Now, if you write
>> obj/inc-field >> obj/field
== 1 'field was incremented but
>> obj/field: 0
Would throw an error, because obj/field is protected to the "client" code Ciao -- alberto