有人说您可以使用 get 与 Rebol 进行(实现继承)。所以我尝试了:
shape: context [
x: 0
y: 0
draw: func['object][
probe get object
]
]
circle: make shape [
radius: 10
draw: get in shape 'draw
]
rectangle: make shape [
draw: get in shape 'draw
]
我想通过引用而不是值传递对象,所以我只使用'Object. 但是我必须这样称呼它
circle/draw 'circle
这是相当蹩脚的,因为我需要重复两次名称 circle 而在通常的继承中,有 this 关键字可以避免这种不自然的语法。有没有更优雅的方式?
谢谢。