lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Jul 9, 2014 8:05 PM, "Coroutines" <coroutines@gmail.com> wrote:

> On Wed, Jul 9, 2014 at 5:03 PM, Paige DePol <lual@serfnet.org> wrote:
>
> > What other strange operators have been spotted in the wild?
>
> The spaceship operator is my favorite ("<=>"):
> https://en.wikipedia.org/wiki/Spaceship_operator

This doesn't count as "in the wild" but I can't resist. Somebody (Ken Fox?) was writing a little tutorial on how to add new value types to an interpreter. There was no existing boolean type, so true/false seemed like a good sample.

Syntax for boolean literals needed to be designed. The new literals had to be invalid under the existing syntax to ensure no working code was broken. Also, there was some concern that people would treat the sample as a desirable language change, so making it *inconvenient* would be nice.

So the literals started as

  (-: true :-)
  )-: false :-(

but the unbalanced parens in the latter drove Emacs users crazy, so it became

  :-( false )-:

I don't think there was any danger of it being widely adopted.