UNQUOTE and DEQUOTE too similar

I created two separate terms regarding removing quoting levels.

One was unquote, e.g. it removes one level:

 >> unquote first ['''a]
 == ''a

It has a /DEPTH refinement where you can say how many levels to remove (so the default depth is 1). If there aren't enough levels it will error.

The other operation was DEQUOTE, which would remove all the quoting levels...it would not complain if something was not quoted:

 >> dequote first ['''a]
 == a

 >> dequote first [a]
 == a

I've messed this up a lot and used the word DEQUOTE where I meant to say UNQUOTE. So those words are too close to each other. There's really no great argument for why the meanings wouldn't be the same or swapped. (e.g. "Why would something called UNQUOTE return a thing that still has quotes on it?")

Regardless of any counter-arguments, I do feel that UNQUOTE makes sense at the end of the day as removing one level of quote.

A refinement to UNQUOTE as something like UNQUOTE/FULLY (more descriptive) or UNQUOTE/ALL (shorter at the cost of clarity) might work:

>> unquote/fully first ['''a]
== a

But it's always a bit unpleasing when you offer refinements that can't be mixed, like /DEPTH and /FULLY would be incompatible.

Also I think this might be kind of a common operation, to ask for the non-quoted essence of a value.


>> nonquoted first ['''a]
== a

But I had aimed that QUOTED and such would be type modifiers, so QUOTED INTEGER! would give you a datatype representing quoted integers.

While all this makes me feel a bit more like excusing DEQUOTE, I have made too many mistakes mixing them up, and if I make them then other people certainly will...


You could think about noquote.
Unquote (quote unquote) and dequote are quite similar and dequote could better remove all quote levels because of the above. Now also UNQUOTED can mean leave no quotes.

1 Like

NOQUOTE is an interesting option.

I've mentioned that UNQUOTED and QUOTED are modifiers I thought would only take types.

>> integer!
== @[integer]

>> type of first ['10]
== @['integer]

>> quoted integer!
== @['integer]

This would be a different operation with narrower uses.

But NOQUOTE is the same part of speech as UNQUOTE, and the same number of letters. So might be a better choice than trying to make something a different part of speech even if it's a "more English looking" word like NONQUOTED.

Might try it for a while and see how it feels.

1 Like