NotNull pointers

Timon Gehr timon.gehr at gmx.ch
Wed Aug 31 14:16:26 PDT 2011


On 08/31/2011 11:10 PM, Simen Kjaeraas wrote:
> On Wed, 31 Aug 2011 21:16:37 +0200, bearophile
> <bearophileHUGS at lycos.com> wrote:
>
>> Simen Kjaeraas:
>>
>>> I feel it is too much a departure from the style otherwise present in D.
>>
>> This is why I have shown my original syntax with [foreach() if()].
>>
>>
>>> It is important not only that the syntax is good in and of itself,
>>> but also in the context of D.
>>
>> The syntax you have shown is noisy and hard to read.
>> Array/seq comps are all (or most) a matter of syntax sugar. So if
>> their syntax is bad, they miss their main point by a mile.
>
> And this is where we disagree. I think the syntax is pretty good, and
> that the
> pythonesque syntax sticks out like a sore thumb. Instead of conflating the
> concepts of filter, map and source data, I aimed for a solution that is
> familiar
> to those accustomed to D, with clear distinctions and the benefits that
> brings.
>
> My design is meant to be somewhat similar to for-loops, with the
> semicolon-separated expressions, and to set builder notation. I kinda
> wish 'in'
> was used in foreach loops (foreach(x in foo){}), as that would be a
> perfect fit
> for the <= in the proposed syntax:
>
> My notation:
> [2 * x; x in iota(10); x*x > 4]
>
> Set builder notation:
> {2 · x | x ∈ ℕ, x² > 4}
>
> Personally, I find set builder notation to be very clear and
> understandable, and
> thus worth striving to imitate. In D however, the curly brackets and comma
> operator already have other meanings that we should try not to interfere
> with.
>

The meaning of the comma is already quite overloaded, so, if it is 
better readable, I think using comma would be fine.




More information about the Digitalmars-d mailing list