July 07, 2009 Re: dmd 1.046 and 2.031 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu Attachments:
| 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. Jerome -- mailto:jeberger@free.fr http://jeberger.free.fr Jabber: jeberger@jabber.fr |
July 07, 2009 Re: dmd 1.046 and 2.031 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | Andrei Alexandrescu:
> I think Walter's message really rendered the whole discussion moot. Post
> of the year:
> =========================
> I like:
> a .. b+1
> to mean inclusive range.
That was my preferred solution, starting from months ago.
Bye,
bearophile
|
July 07, 2009 Re: dmd 1.046 and 2.031 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | Andrei Alexandrescu:
> Safe D is concerned with memory safety only.
And hopefully you will understand that is wrong :-)
Bye,
bearophile
|
July 07, 2009 Re: dmd 1.046 and 2.031 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | 2009/7/7 Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org>: > I think Walter's message really rendered the whole discussion moot. Post of the year: > > ========================= > I like: > > a .. b+1 > > to mean inclusive range. > ========================= Not everything is an integer. --bb |
July 07, 2009 Re: dmd 1.046 and 2.031 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | Bill Baxter wrote:
> 2009/7/7 Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org>:
>> I think Walter's message really rendered the whole discussion moot. Post of
>> the year:
>>
>> =========================
>> I like:
>>
>> a .. b+1
>>
>> to mean inclusive range.
>> =========================
>
> Not everything is an integer.
Works with pointers too.
Andrei
|
July 07, 2009 Re: dmd 1.046 and 2.031 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jérôme M. Berger | 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?
Andrei
|
July 07, 2009 Re: dmd 1.046 and 2.031 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu Attachments:
| 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 -- mailto:jeberger@free.fr http://jeberger.free.fr Jabber: jeberger@jabber.fr |
July 07, 2009 Re: dmd 1.046 and 2.031 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | Andrei Alexandrescu, el 7 de julio a las 13:18 me escribiste: > 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). What about bearophile response: what about x..uint.max+1? -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- More than 50% of the people in the world have never made Or received a telephone call |
July 07, 2009 Re: dmd 1.046 and 2.031 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jérôme M. Berger | 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)...
It wasn't a trick question, or it was of sorts. If you iterate with e.g. foreach through a floating-point range that has b == b + 1, you're bound to get in a lot of trouble because the running variable will be incremented.
Andrei
|
July 07, 2009 Re: dmd 1.046 and 2.031 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Leandro Lucarella | Leandro Lucarella wrote:
> Andrei Alexandrescu, el 7 de julio a las 13:18 me escribiste:
>> 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).
>
> What about bearophile response: what about x..uint.max+1?
How often did you encounter that issue?
Andrei
|
Copyright © 1999-2021 by the D Language Foundation