Rebol has historically used
>> for the console prompt. It also inside the language uses
>> for bit shift operators. Red continues this, and it looks a little weird, e.g.
>> 2 >> 1 == 1
The use of some form of > is fairly common as prompts, going back to
C:\> and before. It's rather common to just find the single character
> used. Yet even in those languages, they use > to mean "greater than". So the idea of prompts themselves pursuing an out-of-band nature is apparently kind of a big thought.
@BrianOtto asked about what I thought of using
>> for comments, and I wanted to mention that I think they are "high value" asymmetric symbol patterns. There's a relatively scarce space of things that can act as short, clean-looking, asymmetric delimiters.
So I think they're wasted as bit shift operators, when more suboptimal choices are being made. e.g. Red has chosen
#() to express literal MAP!s, a parallel to JSON's associative arrays.
>> x: #(a: 10 b: 20) == #( a: 10 b: 20 ) >> x/b == 20
(On a related note, @rgchris and I believe that if anything, construction syntax should have been the one to take #() instead of #, in the sense that it's not creating a BLOCK! of anything...rather it's splicing (kind of like evaluating) an element inline.)
But what if we tried to make the prompt something that didn't have meaning in the language? Let's imagine for a moment that we take that pesky lone ? I've been looking for a "higher" purpose for (after all,
h is a fine console shortcut for help, if one is really too lazy to type
help). And then the complementary !. Let's imagine their higher purpose is no purpose in the language by default, and use them for console prompts...then take
>> for MAP! literals:
? x: <<a: 10 b: 20>> ! << a: 10 b: 20 >> ? x/b ! 20
Contrast with Red's scheme: when you think about looking at a long list of keys and values...and you get to the end and see just a
), you have to scan up to know if you're looking at a GROUP! or not. But here you'd be better off. I think there's a lot more need for something like this than bit shifting.
? is just an idea. Because I'd been looking for a good purpose for ? and !. I kind of thought it might be fun if they were postfix, so it could be like asking a question of something...but that never came off very well. I thought it might be okay for ? foo being shorthand of set? 'foo but while it saves some typing it makes the code look unnatural...and that's not what Rebol is about.
(Same arguments about why we've scrapped the definition !: :not... it's ugly to say ! condition when you could say not condition, and there's no reason to support it.)
So with lone ? and ! being enigmatic, thin and unpopular... the idea of not giving them any default meaning has some amount of appeal...and then they'd be something you could visually filter out. But on that note, regarding recent discussions of backslash of it not being used at all...what if that property were exploited for fun and profit?
Welcome to Rebol. For more information please type in the commands below: HELP - For starting information ABOUT - Information about your Rebol CHANGES - What's different about this version .\
.\ comment "I actually like dot backslash as the prompt" >\ comment "other symbols combine noisily, lone backslash too minimal" breakpoint(3) .\ repeat x 2 [print [x "stuff to the left"]] 1 stuff to the left 2 stuff to the left .\ <<a: "doesn't" b: "clash" c: "with chevrons!">> .\ 1 + 2 =\ 3 .\ all [ [\ 1 < 2 ( (\ 3) [\ ] =\ 3 .\ quote == =\ == .\ quote >> =\ >>
(Colorization would of course help somewhat.)
The interesting thing about what I've done above--including a little cleverness with the multiline--is that you wind up with a transcript that can be pasted into a console session and filtered to run the commands again. Using some of the same rationale as when discussing the backslash being filtered by a "dumb" parser, it doesn't take a lot of intelligence for the console to figure out what your commands were distinct from the output.
Then again, the convention could say that if it sees a backslash it ignores up to one character on the right of it, possibly a space...which might be more conventional-seeming.
breakpoint(3) \> repeat x 2 [print [x "stuff to the left"]] 1 stuff to the left 2 stuff to the left \. <<a: "doesn't" b: "clash" c: "with chevrons!">> \. 1 + 2 \= 3 \. all [ \[ 1 < 2 ( \( 3) \[ ] \= 3
Maybe even some kind of hybrid? :-/
.\ 1 + 2 \= 3
Anyway I'm not going to say MAP! literals are the final ante on what might be done with the very valuable
>>, but it's more in league with the level I think it should be at. And if it's that prominent (or moreso) in the language, then being able to avoid its use in the console prompts has an advantage...so I think these contemplations are worthwhile.