Glenn: > Hi all! I'm trying to learn Rebol by actually writing something with it. :-)
Always the best way! Welcome to the Rebolworld! > How do I differentiate between static class methods and 'normal' > class methods? I think the difficulty here is that REBOL doesn't have methods and classes in anything like the classic Smalltalk way. What it has is *objects* -- which are more limited in some ways and more flexible in others. But also confusingly named -- the term object brings to mind associations from other languages. A REBOL object is also called a content and in some ways that is a less confusing term. So there are no classes as such. A context can be cloned, but then you have (usually -- others can leap in here with the exceptions) separate copies of all its contents. As an quick'n'dirty (and non-error-trapped) example of the traditional stack class/method.....The first version you and I might write may look like this: stack: make object! [ stack-data: copy [] push: func [item] [insert stack-data item] pop: func [/local item] [item: stack-data/1 remove stack-data return item] ] And we can use it like this: stack1: make stack [] ;;one actual instance stack2: make stack [] ;; another one stack1/push 1 stack1/push "x" stack2/push stack1 ;; save stack1 on stack2 -- why not!? stack2/push 99 stack1/pop == "x" stack2/pop == 99 The drawback (or strength!) of this design is when we save stack1 or stack2 to a file. What is saved includes all the functions in each case. For a real-world object that could be a lot of duplicate code. Even for a toy stack it means extra work if we want to change the code in each instance. I wouldn't design a REBOL stack that way if it was to be persistent data. It's just an example of the design different from a "pure" OO language. Sunanda. -- To unsubscribe from the list, just send an email to lists at rebol.com with unsubscribe as the subject.
