REBOL 3.0

Function name for doing WITH or IN a context

Carl Sassenrath, CTO
REBOL Technologies
11-Aug-2007 19:31 GMT

Article #0097
Main page || Index || Prior Article [0096] || Next Article [0098] || 12 Comments || Send feedback

We want to be able to easily evaluate a block in the context of a specific object.

Gregg suggested the word WITH, as in:

with object [a: 10 ....]

That is a good suggestion, similar to VID2 usage of WITH.

I also suggested IN, mainly because I did not want to add a new word...

in object [a: 10 ....]

But, that does make IN do two things that are related, but not identical. (Word bind, and bin block plus evaluate it).

Another option is to write:

do in object [a: 10 ....]

Now IN is consistent, but that's more to type, and programmers don't like typing.

We could also have:

do/in object [...]

But, it's more problematic: 1) it reverses the DO arg order, 2) it slows down DO for everything, just a tiny tiny bit.

It's worth nothing that this function is equivalent to:

do bind/deep/copy [...] object

So, we have the option of of just keeping that. But that format is not as friendly.

Comments?

12 Comments

REBOL 3.0
Updated 19-Aug-2017 - Edit - Copyright REBOL Technologies - REBOL.net