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

Re: SRFI 105: Curly-infix-expressions

On Mon, Aug 27, 2012 at 12:23 PM, Shiro Kawai <shiro@xxxxxxxx> wrote:
> From: "David A. Wheeler" <dwheeler@xxxxxxxxxxxx>
> Subject: Re: SRFI 105: Curly-infix-expressions
> Date: Sun, 26 Aug 2012 20:45:28 -0400 (EDT)
>> Shiro Kawai:
>>> Probably because of my lack of experience of teaching Lisp family
>>> languages to non-Lispers, it is difficult for me to swallow the
>>> reasoning of "not having infix notations alienates people".
>> People typically find familiar notations (or similar ones) easier to use.  It's not that one notation is more "natural" in a cosmic sense, it's familiarity.  But that MATTERS if someone  uses a notation a lot.
>> The world has *standardized*, and has for hundreds of years, on infix notation for math, especially at the pre-college level.  That WILL NOT CHANGE.
> Don't take me wrong.  I'm not arguing that.
> In plain words, I'm questioning if you are trying to solve a
> right problem in this srfi.
> Surely infix op is a part of a solution, but disregarding other
> things that has made infix op actually work, the partial solution
> may not be as useful as we hope for, or even harmful.

Dunno.  But one major use of curly-infix in my own code is
with comparison operators like > < =

WAAY back in kindergarten my teachers taught me to view
> as a mouth.  The mouth wants to eat the bigger thing, so
it faces the bigger thing.  If it's >, the bigger thing is on the
left, while if it's <, the bigger thing is on the right.

That thing stuck with me since ('coz hey, look, I still remember
it! that was when I was like, 3? 4? 5? I'm 29 now.  And I
distinctly remember it as the kindergarten class).

Now, in infix that reasoning holds.  In prefix, > has its
back turned to the bigger thing, which kind makes it wrong.
< looks like it wants to eat everything (greedy mouth!)

> Same thing in operator precedence.  Surely, no precedence is
> simpler and we like simpler rules.  But what do we lose for not
> having precedence?

Note that we don't really lose precedence per se: there's a
hook for that (namely `nfx` and `transform-mixed-infix`).

We want to reserve the "{" and "}" symbols now for curly-infix,
and the community can vote with its feet (i.e. by using or
not using particular `nfx` implementations) on what precedence
system to use.

I (almkglor) personally feel that the issue of precedence is kinda
a bit large (come on, surely no one agrees that == binding tighter
than bit-level & in C is a good idea), and may require a far longer
process than SRFI provides.

Further, in math itself the actual precedence used IIRC is not much
more than <=> over */ over +-.  Some logic books consider
a ^ b v c ^ d and a ^ b ^ c as ill-formed in the absence of
explicit parenthesis for example.