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

Re: SRFI 105: Curly-infix-expressions

This page is part of the web mail archives of SRFI 105 from before July 7th, 2015. The new archives for SRFI 105 contain all messages, not just those from before July 7th, 2015.



> Those infix languages (and SRFI-105) also don't allow what I really
> want to write:
>
>   0 <= x < n

Note that this is more complex than that.

Consider the following code:

{ 0 <= (begin (display "foo!") x) < n }

The simple way to do this would be to translate it to:

{{ 0 <= (begin (display "foo!") x)} and { (begin (display "foo!") x) < n}}

But that will cause the side effects to occur twice if { 0 <= x }.

The correct translation would be:

 (let ((_some_var_ (begin (display "foo!") x)))
  {{ 0 <= _some_var_ } and { _some_var_ < n }})

And that's a lot of hidden complexity for the *reader* to do.

However, if an application writer or library writer wants to write that,
he or she is allowed to bind `nfx`, and is of course responsible
for the correct translation to the second form.

Sincerely,
AmkG