Jump to page: 1 24  
Page
Thread overview
D needs...
May 11, 2015
Namespace
May 11, 2015
Dennis Ritchie
May 11, 2015
weaselcat
May 11, 2015
Daniel Kozák
May 11, 2015
Namespace
May 11, 2015
John Colvin
May 11, 2015
Namespace
May 11, 2015
Timon Gehr
May 11, 2015
Namespace
May 11, 2015
Adam D. Ruppe
May 11, 2015
Namespace
May 11, 2015
Vladimir Panteleev
May 11, 2015
Namespace
May 11, 2015
rom
May 11, 2015
Namespace
May 12, 2015
Marc Schütz
May 12, 2015
Namespace
May 12, 2015
Namespace
May 18, 2015
Namespace
May 25, 2015
Namespace
May 12, 2015
ponce
May 12, 2015
Daniel Kozák
May 12, 2015
Namespace
May 14, 2015
Jack Applegame
May 14, 2015
Namespace
May 21, 2015
Daniel Kozak
May 21, 2015
Namespace
May 21, 2015
Daniel Kozak
May 21, 2015
Daniel Kozak
May 21, 2015
Namespace
May 21, 2015
Meta
May 21, 2015
Daniel Kozak
May 21, 2015
Namespace
May 11, 2015
Inspired by ponce idioms list for D I've set up something similar.
There are some themes in D which come up regulary and are discussed to the vomit. If something is agreed, it gets forgotten sometimes and the theme disappears into oblivion (for a few months :P). To prevent this, I've collected some hot-discussed themes, their history and their current state. I hope this helps to avoid unnecessary discussions in the future and finally cut off these issues (either with an official decision "Nope, keep as it is" or with an implementation).

I've tried to stay as objective as possible, but if something seems to be too subjective, please let me know, so I can fix it.

http://dgame.github.io/dneeds/
May 11, 2015
On Monday, 11 May 2015 at 11:59:02 UTC, Namespace wrote:
> Inspired by ponce idioms list for D I've set up something similar.
> There are some themes in D which come up regulary and are discussed to the vomit. If something is agreed, it gets forgotten sometimes and the theme disappears into oblivion (for a few months :P). To prevent this, I've collected some hot-discussed themes, their history and their current state. I hope this helps to avoid unnecessary discussions in the future and finally cut off these issues (either with an official decision "Nope, keep as it is" or with an implementation).
>
> I've tried to stay as objective as possible, but if something seems to be too subjective, please let me know, so I can fix it.
>
> http://dgame.github.io/dneeds/

Thanks. Many programmers find fault with this problem:

"No problem. But if you have more elements it could be annoying to count them. That's why some D users wanted that the compiler does that for them.

int[$] c = [1, 2, 3]; // the compiler detects the dollar and count the elements for us"
May 11, 2015
On Monday, 11 May 2015 at 12:22:34 UTC, Dennis Ritchie wrote:
> On Monday, 11 May 2015 at 11:59:02 UTC, Namespace wrote:
>> Inspired by ponce idioms list for D I've set up something similar.
>> There are some themes in D which come up regulary and are discussed to the vomit. If something is agreed, it gets forgotten sometimes and the theme disappears into oblivion (for a few months :P). To prevent this, I've collected some hot-discussed themes, their history and their current state. I hope this helps to avoid unnecessary discussions in the future and finally cut off these issues (either with an official decision "Nope, keep as it is" or with an implementation).
>>
>> I've tried to stay as objective as possible, but if something seems to be too subjective, please let me know, so I can fix it.
>>
>> http://dgame.github.io/dneeds/
>
> Thanks. Many programmers find fault with this problem:
>
> "No problem. But if you have more elements it could be annoying to count them. That's why some D users wanted that the compiler does that for them.
>
> int[$] c = [1, 2, 3]; // the compiler detects the dollar and count the elements for us"

+1, I have to go review why this was removed. It's annoying that I have to manually count static arrays.
May 11, 2015
On Monday, 11 May 2015 at 12:22:34 UTC, Dennis Ritchie wrote:
> On Monday, 11 May 2015 at 11:59:02 UTC, Namespace wrote:
>> Inspired by ponce idioms list for D I've set up something similar.
>> There are some themes in D which come up regulary and are discussed to the vomit. If something is agreed, it gets forgotten sometimes and the theme disappears into oblivion (for a few months :P). To prevent this, I've collected some hot-discussed themes, their history and their current state. I hope this helps to avoid unnecessary discussions in the future and finally cut off these issues (either with an official decision "Nope, keep as it is" or with an implementation).
>>
>> I've tried to stay as objective as possible, but if something seems to be too subjective, please let me know, so I can fix it.
>>
>> http://dgame.github.io/dneeds/
>
> Thanks. Many programmers find fault with this problem:
>
> "No problem. But if you have more elements it could be annoying to count them. That's why some D users wanted that the compiler does that for them.
>
> int[$] c = [1, 2, 3]; // the compiler detects the dollar and count the elements for us"

Yeah, but the given example shows you an alternative.
May 11, 2015
On Monday, 11 May 2015 at 11:59:02 UTC, Namespace wrote:
> Inspired by ponce idioms list for D I've set up something similar.
> There are some themes in D which come up regulary and are discussed to the vomit. If something is agreed, it gets forgotten sometimes and the theme disappears into oblivion (for a few months :P). To prevent this, I've collected some hot-discussed themes, their history and their current state. I hope this helps to avoid unnecessary discussions in the future and finally cut off these issues (either with an official decision "Nope, keep as it is" or with an implementation).
>
> I've tried to stay as objective as possible, but if something seems to be too subjective, please let me know, so I can fix it.
>
> http://dgame.github.io/dneeds/

I think in "auto length for fixed-length arrays" you want
auto c = [1, 2, 3].s;
instead of
int[] c = [1, 2, 3].s;
in order to be as close to the int[$] idea as possible.
May 11, 2015
On Monday, 11 May 2015 at 12:53:26 UTC, John Colvin wrote:
> On Monday, 11 May 2015 at 11:59:02 UTC, Namespace wrote:
>> Inspired by ponce idioms list for D I've set up something similar.
>> There are some themes in D which come up regulary and are discussed to the vomit. If something is agreed, it gets forgotten sometimes and the theme disappears into oblivion (for a few months :P). To prevent this, I've collected some hot-discussed themes, their history and their current state. I hope this helps to avoid unnecessary discussions in the future and finally cut off these issues (either with an official decision "Nope, keep as it is" or with an implementation).
>>
>> I've tried to stay as objective as possible, but if something seems to be too subjective, please let me know, so I can fix it.
>>
>> http://dgame.github.io/dneeds/
>
> I think in "auto length for fixed-length arrays" you want
> auto c = [1, 2, 3].s;
> instead of
> int[] c = [1, 2, 3].s;
> in order to be as close to the int[$] idea as possible.

Both work, but you may be right... :)
May 11, 2015
On Mon, 11 May 2015 12:24:34 +0000
weaselcat via Digitalmars-d-announce
<digitalmars-d-announce@puremagic.com> wrote:

> On Monday, 11 May 2015 at 12:22:34 UTC, Dennis Ritchie wrote:
> > On Monday, 11 May 2015 at 11:59:02 UTC, Namespace wrote:
> >> Inspired by ponce idioms list for D I've set up something
> >> similar.
> >> There are some themes in D which come up regulary and are
> >> discussed to the vomit. If something is agreed, it gets
> >> forgotten sometimes and the theme disappears into oblivion
> >> (for a few months :P). To prevent this, I've collected some
> >> hot-discussed themes, their history and their current state. I
> >> hope this helps to avoid unnecessary discussions in the future
> >> and finally cut off these issues (either with an official
> >> decision "Nope, keep as it is" or with an implementation).
> >>
> >> I've tried to stay as objective as possible, but if something seems to be too subjective, please let me know, so I can fix it.
> >>
> >> http://dgame.github.io/dneeds/
> >
> > Thanks. Many programmers find fault with this problem:
> >
> > "No problem. But if you have more elements it could be annoying to count them. That's why some D users wanted that the compiler does that for them.
> >
> > int[$] c = [1, 2, 3]; // the compiler detects the dollar and count the elements for us"
> 
> +1, I have to go review why this was removed. It's annoying that I have to manually count static arrays.

import std.stdio;

@safe @property auto static_array()
{
    static struct _static_array
    {
        @safe
        @property
        T[n] s(T, size_t n)(auto ref T[n] values) { return values; }

        T[0][n] opIndex(size_t n = T.length, T...)(T items)
        {
            typeof(return) arr;
            foreach (index,item; items)
                arr[index] = item;

            return (values) { return values; }(arr);//s!(T[0], n)(arr);
        }
    }

    return _static_array();
}

void main() {
    auto sa = static_array[4,5,7];
    writeln(sa);
}

May 11, 2015
On 05/11/2015 01:59 PM, Namespace wrote:
> Inspired by ponce idioms list for D I've set up something similar.
> There are some themes in D which come up regulary and are discussed to
> the vomit. If something is agreed, it gets forgotten sometimes and the
> theme disappears into oblivion (for a few months :P). To prevent this,
> I've collected some hot-discussed themes, their history and their
> current state. I hope this helps to avoid unnecessary discussions in the
> future and finally cut off these issues (either with an official
> decision "Nope, keep as it is" or with an implementation).
>
> I've tried to stay as objective as possible, but if something seems to
> be too subjective, please let me know, so I can fix it.
>
> http://dgame.github.io/dneeds/


int[] test() {
    return [1, 2, 3].s; // this is stack allocated
}

That's not a very compelling use case. :o)
The stack memory goes right out of scope after having been sliced.
May 11, 2015
On Monday, 11 May 2015 at 13:21:01 UTC, Timon Gehr wrote:
> On 05/11/2015 01:59 PM, Namespace wrote:
>> Inspired by ponce idioms list for D I've set up something similar.
>> There are some themes in D which come up regulary and are discussed to
>> the vomit. If something is agreed, it gets forgotten sometimes and the
>> theme disappears into oblivion (for a few months :P). To prevent this,
>> I've collected some hot-discussed themes, their history and their
>> current state. I hope this helps to avoid unnecessary discussions in the
>> future and finally cut off these issues (either with an official
>> decision "Nope, keep as it is" or with an implementation).
>>
>> I've tried to stay as objective as possible, but if something seems to
>> be too subjective, please let me know, so I can fix it.
>>
>> http://dgame.github.io/dneeds/
>
>
> int[] test() {
>     return [1, 2, 3].s; // this is stack allocated
> }
>
> That's not a very compelling use case. :o)
> The stack memory goes right out of scope after having been sliced.

Argh, of course. The return type must be auto. :)
May 11, 2015
On Monday, 11 May 2015 at 13:21:01 UTC, Timon Gehr wrote:
> The stack memory goes right out of scope after having been sliced.

I hate that static arrays are implicitly sliced. It leads to common memory safety bugs in places like that.
« First   ‹ Prev
1 2 3 4