Thread overview | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 29, 2013 DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
I was reading 2.064 changelog on website. Check this: template Tuple(T...) { alias Tuple = T; } template isIntOrFloat(T) { static if (is(T == int) || is(T == float)) enum isIntOrFloat = true; else enum isIntOrFloat = true; } I guess the "else" branch should be " = false" rather than " = true"; |
October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrea Fontana | On Tuesday, 29 October 2013 at 09:43:23 UTC, Andrea Fontana wrote:
> I was reading 2.064 changelog on website.
> Check this:
>
> template Tuple(T...) { alias Tuple = T; }
>
> template isIntOrFloat(T)
> {
> static if (is(T == int) || is(T == float))
> enum isIntOrFloat = true;
> else
> enum isIntOrFloat = true;
> }
>
> I guess the "else" branch should be " = false" rather than " = true";
Why the changelog for 2.064 is even available on dlang.org?
|
October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tourist | On Tuesday, 29 October 2013 at 09:44:36 UTC, Tourist wrote:
> On Tuesday, 29 October 2013 at 09:43:23 UTC, Andrea Fontana wrote:
>> I was reading 2.064 changelog on website.
>> Check this:
>>
>> template Tuple(T...) { alias Tuple = T; }
>>
>> template isIntOrFloat(T)
>> {
>> static if (is(T == int) || is(T == float))
>> enum isIntOrFloat = true;
>> else
>> enum isIntOrFloat = true;
>> }
>>
>> I guess the "else" branch should be " = false" rather than " = true";
>
> Why the changelog for 2.064 is even available on dlang.org?
I guess it's a good thing, it's available online. While looking through it, I also noticed that there are new functions 'stripLeft/stripRight'. I believe it would be more consistent to call those stripFront/stripBack.
|
October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrea Fontana | On 2013-10-29 10:43, Andrea Fontana wrote: > I was reading 2.064 changelog on website. > Check this: > > template Tuple(T...) { alias Tuple = T; } > > template isIntOrFloat(T) > { > static if (is(T == int) || is(T == float)) > enum isIntOrFloat = true; > else > enum isIntOrFloat = true; > } > > I guess the "else" branch should be " = false" rather than " = true"; > Or just: template isIntOrFloat(T) { enum isIntOrFloat = is(T == int) || is(T == float) } -- /Jacob Carlborg |
October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Tuesday, 29 October 2013 at 10:26:13 UTC, Jacob Carlborg wrote:
> On 2013-10-29 10:43, Andrea Fontana wrote:
>> I was reading 2.064 changelog on website.
>> Check this:
>>
>> template Tuple(T...) { alias Tuple = T; }
>>
>> template isIntOrFloat(T)
>> {
>> static if (is(T == int) || is(T == float))
>> enum isIntOrFloat = true;
>> else
>> enum isIntOrFloat = true;
>> }
>>
>> I guess the "else" branch should be " = false" rather than " = true";
>>
>
> Or just:
>
> template isIntOrFloat(T)
> {
> enum isIntOrFloat = is(T == int) || is(T == float)
> }
Didn't we get the shorthand enum template syntax in this release?
enum isInOrFloat(T) = is(T == int) || is(T == float)
|
October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rene Zwanenburg | On 29 October 2013 12:13, Rene Zwanenburg <renezwanenburg@gmail.com> wrote: > On Tuesday, 29 October 2013 at 10:26:13 UTC, Jacob Carlborg wrote: >> >> On 2013-10-29 10:43, Andrea Fontana wrote: >>> >>> I was reading 2.064 changelog on website. >>> Check this: >>> >>> template Tuple(T...) { alias Tuple = T; } >>> >>> template isIntOrFloat(T) >>> { >>> static if (is(T == int) || is(T == float)) >>> enum isIntOrFloat = true; >>> else >>> enum isIntOrFloat = true; >>> } >>> >>> I guess the "else" branch should be " = false" rather than " = true"; >>> >> >> Or just: >> >> template isIntOrFloat(T) >> { >> enum isIntOrFloat = is(T == int) || is(T == float) >> } > > > Didn't we get the shorthand enum template syntax in this release? > > enum isInOrFloat(T) = is(T == int) || is(T == float) In 2.063? No we didn't. -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0'; |
October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Iain Buclaw | On Tuesday, 29 October 2013 at 14:15:27 UTC, Iain Buclaw wrote:
> On 29 October 2013 12:13, Rene Zwanenburg <renezwanenburg@gmail.com> wrote:
>> Didn't we get the shorthand enum template syntax in this release?
>>
>> enum isInOrFloat(T) = is(T == int) || is(T == float)
>
> In 2.063? No we didn't.
Oops, I didn't notice the quoted code came from the section describing the new syntax. Never mind :)
|
October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sergei Nosov | On Tuesday, 29 October 2013 at 10:08:00 UTC, Sergei Nosov wrote:
> On Tuesday, 29 October 2013 at 09:44:36 UTC, Tourist wrote:
>> On Tuesday, 29 October 2013 at 09:43:23 UTC, Andrea Fontana wrote:
> I guess it's a good thing, it's available online. While looking through it, I also noticed that there are new functions 'stripLeft/stripRight'. I believe it would be more consistent to call those stripFront/stripBack.
+1
|
October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrea Fontana | On 10/29/13, Andrea Fontana <nospam@example.com> wrote: > I guess the "else" branch should be " = false" rather than " = true"; It was fixed: https://github.com/D-Programming-Language/dlang.org/pull/403 On 10/29/13, Tourist <gravatar@gravatar.com> wrote: > Why the changelog for 2.064 is even available on dlang.org? Because of a great organization. |
October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sergei Nosov | On Tuesday, 29 October 2013 at 10:08:00 UTC, Sergei Nosov wrote: > I guess it's a good thing, it's available online. While looking through it, I also noticed that there are new functions 'stripLeft/stripRight'. I believe it would be more consistent to call those stripFront/stripBack. Yes, it would be, but they are also a generalization of the eponymous string functions. Naming the new functions "stripFront/stripBack" instead of "stripLeft/stripRight" would itself be the more inconsistent. For example: //std.string.stripLeft assert(stripLeft(" \tHello") == "Hello"); //std.algorithm.stripLeft(R, E)(R r, E e); assert(stripLeft(" \tHello", ' ') == "\tHello"); //std.algorithm.stripLeft(alias pred, R)(R r); assert(stripLeft!(Not!isLower)(" \tHello", ' ') == "ello"); But you make a valid point. |
Copyright © 1999-2021 by the D Language Foundation