dmd 1.046 and 2.031 releases

Derek Parnell derek at psych.ward
Tue Jul 7 15:45:19 PDT 2009


On Tue, 07 Jul 2009 21:20:42 +0200, "Jérôme M. Berger" wrote:

> Andrei Alexandrescu wrote:
>> Jérôme M. Berger wrote:
>>> Andrei Alexandrescu wrote:
>>>> Jérôme M. Berger wrote:
>>>>> Andrei Alexandrescu wrote:
>>>>>> Derek Parnell wrote:
>>>>>>> It seems that D would benefit from having a standard syntax format 
>>>>>>> for
>>>>>>> expressing various range sets;
>>>>>>>  a. Include begin Include end, i.e. []
>>>>>>>  b. Include begin Exclude end, i.e. [)
>>>>>>>  c. Exclude begin Include end, i.e. (]
>>>>>>>  d. Exclude begin Exclude end, i.e. ()
>>>>>>
>>>>>> I'm afraid this would majorly mess with pairing of parens.
>>>>>>
>>>>>     I think Derek's point was to have *some* syntax to mean this, 
>>>>> not necessarily the one he showed (which he showed because I believe 
>>>>> that's the "standard" mathematical way to express it for English 
>>>>> speakers). For example, we could say that [] is always inclusive and 
>>>>> have another character which makes it exclusive like:
>>>>>  a. Include begin Include end, i.e. [  a .. b  ]
>>>>>  b. Include begin Exclude end, i.e. [  a .. b ^]
>>>>>  c. Exclude begin Include end, i.e. [^ a .. b  ]
>>>>>  d. Exclude begin Exclude end, i.e. [^ a .. b ^]
>>>>
>>>> I think Walter's message really rendered the whole discussion moot. 
>>>> Post of the year:
>>>>
>>>> =========================
>>>> I like:
>>>>
>>>>    a .. b+1
>>>>
>>>> to mean inclusive range.
>>>> =========================
>>>>
>>>> Consider "+1]" a special symbol that means the range is to be closed 
>>>> to the right :o).
>>>>
>>>     Ah, but:
>>>  - This is inconsistent between the left and right limit;
>>>  - This only works for integers, not for floating point numbers.
>> 
>> How does it not work for floating point numbers?
>> 
> 	Is that a trick question? Depending on the actual value of b, you 
> might have b+1 == b (if b is large enough). Conversely, range a .. 
> b+1 may contain a lot of extra numbers I may not want to include 
> (like b+0.5)...
> 
> 		Jerome

If Andrei is not joking (the smiley notwithstanding) the "+1" doesn't mean
add one to the previous expression, instead it means that the previous
expression's value is the last value in the range set.

Subtle, no?

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell


More information about the Digitalmars-d-announce mailing list