Infix operator names

From: David Cressey <cressey73_at_verizon.net>
Date: Sun, 01 Apr 2007 21:30:13 GMT
Message-ID: <FvVPh.2867$hI4.2462_at_trndny08>



After programming in other languages for almost 18 years, I learned Pascal.

I found Pascal's infix operators easy to write and, more importantly, easy to read. Pascal's infix operators use a few symbols, like "and", "or",
"div" "mod", and "in" as infix operators. Also "not" as a unary operator.
I found this easy to take. Especially since there was a complete list of them up front in the user manual, so I didn't keep tripping over undiscovered ones. Also, unlike the discussion in c.d.t. there were no single letter symbol operators.

Note especially the "in" operator. The left operand is an ordinal, and the right operand is a set based on the same ordinal, IIRC. SQL's "in" is a little more general than Pascal's but it's the same idea. I'm not a fan of overloading, especially when it comes to making code legible. I'll put up with it, but I won't enjoy it.

I'm also not a fan of lots of completely mysterious symbols as operators. I read just a little APL, and decided not to write any of it.

In a programming language that I'm designing as a hobby, I have an infix operator called "format". The left operand is of just about any data type, and the right operand is a character string shaws shows how to format the other operand. It yields a character string. This is a little like the
"to_char" function in Oracle, or the FORMAT statement in Fortran, or some
feature of Basic that I don't remember. Thus

billing_date format "DD-MMM-YY" might yield "05-DEC-07" as a result. I haven't figured out what to call the inverse operator, or even how it should work. Received on Sun Apr 01 2007 - 23:30:13 CEST

Original text of this message