February 17, 2012
On 17 February 2012 05:14, H. S. Teoh <hsteoh@quickfur.ath.cx> 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!  I mean, D is already
> standardized on Unicode, why not take advantage of all those nice
> symbols that Unicode provides? ;-) (As long as you don't mention APL,
> everybody will be just fine.)
>

This is starting to sound more and more like Feep's little compiler
project Neat (formerly fcc).


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
February 17, 2012
Le 17/02/2012 05:35, Jonathan M Davis a écrit :
> On Thursday, February 16, 2012 22:31:18 Caligo wrote:
>> C++ has this and it makes code little more readable in certain cases:
>>
>> if(something() or foo() and bar()){  ... }
>>
>> instead of this in D:
>>
>> if(something() || foo()&&  bar()){ ... }
>>
>>
>> possible enhancement request?  or is there a good reason it is not in
>> the language?
>
> Since when does C++ have "or" and "and"? C++ uses || and&&, just like C and
> Java and C# and... I'm sure that there's a language somewhere whch uses "or"
> and "and," but I've never used one that did.
>
> And I'm actually mildly shocked that anyone (at least any programmer) would
> think that "or" and "and" were more readable. The fact that operators aren't
> words is a _major_ boon to code readibility.
>
> - Jonathan M Davis

Mayny languages have both. Usually, people ends up using only one of them (&& or ||) and reserve the other one for dirty tricks (connect() or die()) abusing lazy evaluation.

I'm not aware of idoms in all langauges, for all languages I know about, fact showed us that && and || is a better alternative.
February 18, 2012
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.

>  I mean, D is already
> standardized on Unicode, why not take advantage of all those nice
> symbols that Unicode provides? ;-) (As long as you don't mention APL,
> everybody will be just fine.)
>
>
> T
>

February 18, 2012
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) {
		...
	}

;-)


T

-- 
Trying to define yourself is like trying to bite your own teeth. -- Alan Watts
February 19, 2012
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?
1 2
Next ›   Last »