Question

I have an object with a function named open that need to call global open.

obj: make object! [
    open: func [fn] [
        client: open fn ...
    ]
]

This obiously fails with stack overflow...

So, how can access global open inside object open ? (Please don't tell me "change name" :-)

Was it helpful?

Solution

In Rebol 3, you can use lib/open to refer to the built-in open function.

lib is an object (which in Rebol-lingo is also sometimes called a "context") which holds all publicly exported functions, including built-in functions. The full name for the lib context is system/contexts/lib (so you could also use system/contexts/lib/open to refer to the open built-in), but because that's a mouthful, the convenience shortcut lib is provided as well.

Also see Brian Hawley's answer regarding "user-defined words" and Carl Sassenrath's post on the basic contexts of R3 for more technical detail.

OTHER TIPS

In Rebol 2, you can use system/words/open. If you look at the source of the Rebol 2 protocols, you'll see short cuts defined to these words so that they don't conflict with the same named words in the protocols.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top