I'm currently defining a 'print element of an object as a function. I'm
assuming that the REBOL definition of 'print will be hidden in the
definition of this object (and definitions of functions local to the object)
- which is ok. Outside of the element 'print, the REBOL definition works
just fine. Following is the relevant piece of my object:
player-def: make object! [
name: none
connection: none
; METHODS
; - - - - - - - - - - - - - - - - - - - - - -
print: function [
"Print a message to this player, with trailing new-line"
msg [string! block!]
][new-msg][
; Cleanup the message suitable for telnet display
new-msg: player-format-print msg
append new-msg new-line
append connection new-msg
]
; - - - - - - - - - - - - - - - - - - - - - -
prin: function [
"Print a message to this player"
msg [string! block!]
][new-msg][
; Cleanup the message suitable for telnet display
new-msg: player-format-print msg
append connection new-msg
]
]
- Michael Jelinek
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 11, 2000 11:32 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] [REBOL] Redefining functions with objects
I'm thinking of developing a class.
Let's call it
tims-object
Suppose I write a function for this
class and I call it
print
Will
tims-object/print
redefine rebol's own print?
I don't really want to do this, so
I would welcome comments on this.
thanks
tim