[REBOL] Propagating Refinements
From: greggirwin:starband at: 10-Sep-2001 11:58
Is it possible to, in a simple way, propagate refinements to other
functions? For example, I want my stack/add routine to support an /only
refinement, which it then passes on to insert (example code below). Can you
do it without an either clause, or getting more involved as Ladislav's
refined function does?
Thanks!
--Gregg
stack: make object! [
_data: make block! 25 ; Use list! instead of block!?
clear: does [_data: make block! 25]
count: does [return length? _data]
empty?: does [return count = 0]
item: does [if not empty? [return last _data]]
remove: does [if not empty? [system/words/remove back tail _data]]
add: func [value /only] [
either only [
insert/only tail _data :value
][
insert tail _data :value
]
]
contains?: func [value /only] [
either only [
return found? find/only _data value
][
return found? find _data value
]
]
]