Jump to page: 1 2
Thread overview
DMD 2.064 changelog typo?
Oct 29, 2013
Andrea Fontana
Oct 29, 2013
Tourist
Oct 29, 2013
Sergei Nosov
Oct 29, 2013
eles
Oct 29, 2013
monarch_dodra
Oct 29, 2013
Nicolas Sicard
Oct 29, 2013
monarch_dodra
Oct 29, 2013
Andrej Mitrovic
Oct 30, 2013
monarch_dodra
Oct 30, 2013
Philip Miess
Oct 31, 2013
Jonathan M Davis
Oct 29, 2013
Jacob Carlborg
Oct 29, 2013
Rene Zwanenburg
Oct 29, 2013
Iain Buclaw
Oct 29, 2013
Rene Zwanenburg
Oct 29, 2013
Andrej Mitrovic
October 29, 2013
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
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
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
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
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
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
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
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
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
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.
« First   ‹ Prev
1 2