On 02/18/2012 11:21 AM, H. S. Teoh wrote:
On Sat, Feb 18, 2012 at 09:45:10AM -0800, bcs wrote:
On 02/16/2012 09:14 PM, H. S. Teoh wrote:
On Thu, Feb 16, 2012 at 09:00:39PM -0800, Walter Bright wrote:
On 2/16/2012 8:47 PM, H. S. Teoh wrote:
Well, in that case, we should replace 'in' with '∈'.

I would, but that doesn't work because of keyboarding issues.

I wasn't being serious.  I was going to suggest to those who complain
about&&   being too similar to&, that we should adopt ∧ and ∨ instead.
Nice and readable, and unambiguous. And we could use ∀ instead of
'foreach'; that would save so much typing!

∀ is "for all" so it couldn't be used. The code might hit a break.
[...]

We could replace 'if (cond) break;' to 'except (cond)', so it would be
"for all ...  except". So you'd have:

        int[] array = [ ... ];
        ∀ x ∈ array except (x==42) {
                ...
        }


That would work for continue, but not break. ∀ and ∈ are set operators and foreach is inherently a sequence operation.

OTOH a "∀ ... ∈ ... → ..." statement that does have set semantics (un-ordered, independent evaluations) would be interesting. It would be parallelizable for one things. The trick would be figuring out how to combine side effects and prevent race conditions. Has any language formalised the concept of transitive side effects?

Reply via email to