[REBOL] with ?
From: arolls::bigpond::net::au at: 4-Dec-2000 14:39
You know how other languages have a statement like this:
name = "object 1"
size = 23
which is to access elements of the obj object, without having to
use a path notation like: obj/name obj/size etc.
Does rebol have anything like this?
Could a function be built into an object that accepts a block of
code and does it inside the object, therefore no longer needing
to explicitly refer to obj/name, just name, etc ?
For example, if the special function is called 'with, the call
would be something like:
obj/with [name: "object 1" size: 23]
The code then gets done inside the object.
This should be equivalent to:
obj/name: "object 1"
It's not urgent, just interesting.
(My little attempt just now failed. -> with: func [code][do code])