REBOL 3.0

Comments on: 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

Comments:

Reisacher
12-Aug-2007 2:19:55
"do in" is just one character more than "with". So this argument against is not very valid. And its really consistent with what is already existent.
jf_allie
12-Aug-2007 13:15:02
The programming implications are way over my head... none the less here is a thought.

If one sees a context as a house, then doing something WITH a house doesn't sound the same as doing something IN a house.

maarten
12-Aug-2007 15:30:29
within context block

and there is no pun intended here wrt the article Or:

inside context block

as you can also do local (re-)assignment in this case. Keep 'in as it is.

Carl Sassenrath
12-Aug-2007 23:57:48
Thanks for feedback

Note that both WITHIN and INSIDE are defined in R2 (for graphics mapping), so those definitions may also be in R3.

The current prototype uses DO IN... but, not final. Let's see what users think.

-pekr-
13-Aug-2007 2:58:44
Well, just week ago I have some thought about how to "prevent" long/path/usage/in/source/code :-) The example was protocol code. I thougt about some kind of binding on demand, where you would state what context you temporarily link to your current one, kind of file system link :-)

The trouble is, that particularly in protocol code in R2, that is needed, as we define words, which has its own meaning in global context too. Well, that was just the idea, of how to prevent constant path usage, which makes source code look ugly. You surely noticed you too abbreviate your path, e.g. in view, using v* shortcut.

I would be fine with 'import, 'use, 'here, 'with, 'in function names ...

Cheers, Petr

-pekr-
13-Aug-2007 3:01:27
Why I don't like 'do. Well, I have not deep enough knowledge of REBOL evaluation, and I also do not know where it comes from, but I am scared all the time I see 'do :-) Dunno why, maybe because of past discussion? I have fear that with 'do I am risking "do format my HD", but that problem surely exists in my head only :-) However, I would prefer special function name instead of using do ...
Reisacher
13-Aug-2007 3:15:57
"do in" has also the advantage, that in case of ever compiling you know where to be careful, if all crucial parts start with do.
fx5
14-Aug-2007 4:59:16
I like "do in" most.
"with" is ok, but "do in" is better.
Frank
Brian Hawley
14-Aug-2007 13:57:18
I prefer DO IN, because splitting the process into two steps allows you to do these two steps at different times. The behavior is more consistent as well, and the DO IN phrase fits in with the other IN phrases (GET IN, SET IN).
Volker
15-Aug-2007 1:32:55
"help with" is easy. "help do help in" is harder.
Anton Rolls
15-Aug-2007 3:55:22
I like DO IN the most, as well.
Ingo
17-Aug-2007 18:01:08
"with" may already be known to some from the pascal family of languages.

Post a Comment:

You can post a comment here. Keep it on-topic.

Name:

Blog id:

R3-0097


Comment:


 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote
 
 

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

REBOL 3.0
Updated 23-Apr-2024 - Edit - Copyright REBOL Technologies - REBOL.net