Among purposes we might apply JUST for, I think it could be a better name for LIT.

Quick reminder that QUOTE means something different... it means add a generalized quoting level to the argument:

>> quote 10
== '10

>> x: 10

>> quote x
== '10

>> quote x + 20
== '30

>> quote quote x
== ''10

>> quote/depth [a block] 3
== '''[a block]

I can't think of a better name for that than QUOTE. So what Rebol2's QUOTE did ("give me the following value literally") was taken over by LITERAL.

>> literal x
== x

But when you give an operation a noun name, then it competes with when you might want a variable to hold that. So if you have a list of "literals" you might say for-each literal literals [...]. I had an idea to work around this by calling it LITERALLY:

>> literally x
== x

But both LITERAL and LITERALLY feel too long, so it was abbreviated as LIT:

>> lit x
== x

Which you can get used to, but still it's an abbreviation and not a word, so it is a bit of a wart.

Compared to all of this, JUST ticks all the boxes.

  • short
  • a real, un-abbreviated word
  • not a noun and unlikely to be desired as a variable name

It feels very intuitive:

>> just x
== x

>> quote just x
== 'x

I had thought the name wouldn't matter that much since generic quoting would mean you'd nearly never use it. However, quoting has other effects which means we probably want to encourage people not to use evaluative quoting of GROUP!s/etc. unless they are sure they know what they're doing (wouldn't be any worse than historical properties, but we're trying to be better).

This tips the scales in favor of using ONLY for a block-making operation that consists of the single argument you give it, which @rgchris had warmed up to:

>> only 1000 + 20
== [1020]

>> only [d]
== [[d]]

This creates a little bit of friction with those wishing to use /ONLY as a refinement name. But it's not a particularly great refinement name anyway...and this problem exists for lots of words (e.g. /ALL). I've posted about the need for solutions to naming refinements out of the way.

I've changed over to this so we can try it out. No one's really gotten used to LIT anyway, and I feel pretty good about how the change to JUST looks seeing it used around in the code...so I'll see if that feeling persists.

It is not difficult to change back.


I'm still trying this, to see how used to it I get. The theory is that if something like this is in use for a while, you start to be able to tell whether it's more natural once the familiar answer hasn't been around for a while...

I don't know if I've gotten to total familiarity; it still seems a bit weird. However, I'm definitely starting to look at things that have LIT in them as seeming more like gibberish...

If we were going for maximum clarity, I think "literally" is the most clear:

>> append [a b c] literally d
== [a b c d]

But no one wants to write that in practice, so the reality would be that the code would have lit everywhere. So I think it's likely that JUST is a keeper.

>> append [a b c] just d
== [a b c d]

So in an interesting development, "LIT" now actually does mean "literal-IZE"...so if anything it should be a synonym for QUOTE. But I like [QUOTE UNQUOTE] more than [LIT UNLIT] or whatever.

Keeping LIT free also means you have a name for a variable holding a LIT!

>> @ 1020
== '1020

>> lit: first [@]
== @

>> type of lit
== #[datatype! lit!]

Looks that way. I've grown to quite like it; it seems very natural.

I always look at lit as in the light, as in the room was nicely lit. Or it has been set on fire :thinking:.

It seems to me now somewhat obvious that the right name for this operator is THE.

>> the x
== x

>> the (1 + 2)
== (1 + 2)

That just clicks. Much better than when I was considering THE as a name for ENSURE (as in Lisp)...or for the concept of "ensure non null".

So JUST is back in the running for being the way that single items can participate with things like FIND and APPEND when working with ANY-ARRAY!. But in a new way...


 >> the x
 == x

 >> quote the x
 == 'x

 >> just x
 == 'x

This helps people avoid breaking the flow of their writing when manipulating single items in block contexts:

>> append [a b c] just [d e f]
== [a b c [d e f]]

>> append [a b c] just d
== [a b c d]

Remember that if you want to evaluate the argument and then quote it, you can use QUOTE.

>> append [a b c] quote 1 + 2
== [a b c 3]
1 Like