Re: Formatted output of range of tuples

2014-10-12 Thread Ali Çehreli via Digitalmars-d-learn
On 10/08/2014 02:31 PM, bearophile wrote: > For indexes now there is also "enumerate". > > Bye, > bearophile Thanks for the tip. std.range.enumerate makes a big difference: foreach (i, element; MyRange(42).enumerate) { // ... } versus sequence!"n" and zip: foreach (i, elem

Re: how to call class' template constructor

2014-10-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/12/14 3:46 PM, ketmar via Digitalmars-d-learn wrote: Hello. please, how to call template constructor of a class? it's completely escaped my mind. i.e. i have this class: class A { this(alias ent) (string name) { ... } } and i want to do: void foo () { ... }

Re: Method signature differences in core modules on dmd and gdc?

2014-10-12 Thread ketmar via Digitalmars-d-learn
On Sun, 12 Oct 2014 22:05:16 + Gary Willoughby via Digitalmars-d-learn wrote: > Ah right, so these methods changed recently? yes. this is from gdc source: static void* calloc( size_t sz, uint ba = 0 ) pure nothrow and this is from current dmd HEAD: static void* calloc( size_t sz, uint

Re: Method signature differences in core modules on dmd and gdc?

2014-10-12 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 12 October 2014 at 19:34:30 UTC, Iain Buclaw wrote: On Sunday, 12 October 2014 at 19:20:49 UTC, Gary Willoughby wrote: I've been recently trying GDC out to compile some D code and i'm running into the problem of differing function signatures in core modules. For example: stack.d:7

Re: how to call class' template constructor

2014-10-12 Thread ketmar via Digitalmars-d-learn
On Sun, 12 Oct 2014 20:29:39 + JR via Digitalmars-d-learn wrote: > Template the whole class? class A(alias ent)? no, that will produce different classes for different types, and i need just one class, but initialized with different entities. with templated class i need to make A ancestor of

Re: how to call class' template constructor

2014-10-12 Thread anonymous via Digitalmars-d-learn
On Sunday, 12 October 2014 at 19:46:41 UTC, ketmar via Digitalmars-d-learn wrote: Hello. please, how to call template constructor of a class? it's completely escaped my mind. i.e. i have this class: class A { this(alias ent) (string name) { ... } } and i want to do: void

Re: how to call class' template constructor

2014-10-12 Thread Cliff via Digitalmars-d-learn
On Sunday, 12 October 2014 at 19:46:41 UTC, ketmar via Digitalmars-d-learn wrote: Hello. please, how to call template constructor of a class? it's completely escaped my mind. i.e. i have this class: class A { this(alias ent) (string name) { ... } } and i want to do: void

Re: Really in need of help with std.container.array.d

2014-10-12 Thread Nordlöw
On Sunday, 12 October 2014 at 20:17:38 UTC, Nordlöw wrote: https://github.com/nordlow/phobos/commit/5c57cb18c2b9d340a19d19207deca5af0339cf7e#diff-0 Made some corrections https://github.com/nordlow/phobos/compare/inout-array-range but gives a similar error array.d(223,19): Error: variable s

Re: how to call class' template constructor

2014-10-12 Thread JR via Digitalmars-d-learn
On Sunday, 12 October 2014 at 19:46:41 UTC, ketmar via Digitalmars-d-learn wrote: Hello. please, how to call template constructor of a class? it's completely escaped my mind. i.e. i have this class: class A { this(alias ent) (string name) { ... } } and i want to do: void

Really in need of help with std.container.array.d

2014-10-12 Thread Nordlöw
I'm trying to figure out how to add complete support for constness in std.container.array.Array at https://github.com/D-Programming-Language/phobos/commit/703305f0bfb1cc22eff3e44e351cc3db3e03f94f#commitcomment-8114056 My current solution (which currently fails) at https://github.com/nordlow/ph

how to call class' template constructor

2014-10-12 Thread ketmar via Digitalmars-d-learn
Hello. please, how to call template constructor of a class? it's completely escaped my mind. i.e. i have this class: class A { this(alias ent) (string name) { ... } } and i want to do: void foo () { ... } auto a = new A!foo("xFn"); yet compiler tells me that "template in

Re: Method signature differences in core modules on dmd and gdc?

2014-10-12 Thread Iain Buclaw via Digitalmars-d-learn
On Sunday, 12 October 2014 at 19:20:49 UTC, Gary Willoughby wrote: I've been recently trying GDC out to compile some D code and i'm running into the problem of differing function signatures in core modules. For example: stack.d:79: error: function core.memory.GC.calloc (ulong sz, uint ba = 0

Re: Method signature differences in core modules on dmd and gdc?

2014-10-12 Thread ketmar via Digitalmars-d-learn
On Sun, 12 Oct 2014 19:20:47 + Gary Willoughby via Digitalmars-d-learn wrote: > These compile fine using DMD. Anybody know what the issue is here? gdc is still 2.065, while official dmd is 2.066. signatures of this functions was changed inbetween. or maybe that was changed for upcoming 2.067,

Method signature differences in core modules on dmd and gdc?

2014-10-12 Thread Gary Willoughby via Digitalmars-d-learn
I've been recently trying GDC out to compile some D code and i'm running into the problem of differing function signatures in core modules. For example: stack.d:79: error: function core.memory.GC.calloc (ulong sz, uint ba = 0u) is not callable using argument types (ulong, BlkAttr, TypeInfo_A

Re: building shared library from D code to import into cython

2014-10-12 Thread Ellery Newcomer via Digitalmars-d-learn
On Sunday, 12 October 2014 at 16:07:19 UTC, Laeeth Isharc wrote: Any thoughts on speed in 2014 of pyd vs using cython to talk to D directly via C/C++ interface? I saw this old coment here: pyd is basically just a convenience layer on top of the C interface. The part that would most likely

Re: building shared library from D code to import into cython

2014-10-12 Thread Laeeth Isharc via Digitalmars-d-learn
Thanks for this. I am aware of pyd and will take a look at source/build process. Any thoughts on speed in 2014 of pyd vs using cython to talk to D directly via C/C++ interface? I saw this old coment here: prabhuramachandran.blogspot.co.uk/2008/09/python-vs-cython-vs-d-pyd-vs-c-swig " predi

Re: [yajl-d] hello world with json arrays

2014-10-12 Thread Jack via Digitalmars-d-learn
On Sunday, 12 October 2014 at 04:17:42 UTC, Jack wrote: Disclaimer: Don't eat me. I was just wondering to those who are experienced in using yajl-d to show me the proper implementation of using it with arrays. So far this is what I understand from parsing Json Objects: class random{ private

Re: return types of std.functional functions

2014-10-12 Thread bearophile via Digitalmars-d-learn
yawniek: i found two snippets from the functional docs that do not work (anymore?) http://dlang.org/phobos/std_functional.html assert(compose!(map!(to!(int)), split)("1 2 3") == [1, 2, 3]); and int[] a = pipe!(readText, split, map!(to!(int)))("file.txt"); throwing a std.array.array into the

Re: return types of std.functional functions

2014-10-12 Thread Ali Çehreli via Digitalmars-d-learn
On 10/12/2014 08:04 AM, yawniek wrote: i found two snippets from the functional docs that do not work (anymore?) http://dlang.org/phobos/std_functional.html assert(compose!(map!(to!(int)), split)("1 2 3") == [1, 2, 3]); and int[] a = pipe!(readText, split, map!(to!(int)))("file.txt"); throwing

return types of std.functional functions

2014-10-12 Thread yawniek via Digitalmars-d-learn
i found two snippets from the functional docs that do not work (anymore?) http://dlang.org/phobos/std_functional.html assert(compose!(map!(to!(int)), split)("1 2 3") == [1, 2, 3]); and int[] a = pipe!(readText, split, map!(to!(int)))("file.txt"); throwing a std.array.array into the mix works f

Re: DList!int.remove(range.takeOne) - workarounds?

2014-10-12 Thread Algo via Digitalmars-d-learn
On Sunday, 12 October 2014 at 10:35:19 UTC, monarch_dodra wrote: On Sunday, 12 October 2014 at 09:45:22 UTC, Algo wrote: DList seems to have an issue with remove: void main() { import std.container, std.range, std.algorithm; auto list = DList!int([1, 2, 4, 6]); auto res = find(list[],

Re: DList!int.remove(range.takeOne) - workarounds?

2014-10-12 Thread monarch_dodra via Digitalmars-d-learn
On Sunday, 12 October 2014 at 09:45:22 UTC, Algo wrote: DList seems to have an issue with remove: void main() { import std.container, std.range, std.algorithm; auto list = DList!int([1, 2, 4, 6]); auto res = find(list[], 2); list.remove(res); //ok /* list.remove(res.takeO

DList!int.remove(range.takeOne) - workarounds?

2014-10-12 Thread Algo via Digitalmars-d-learn
DList seems to have an issue with remove: void main() { import std.container, std.range, std.algorithm; auto list = DList!int([1, 2, 4, 6]); auto res = find(list[], 2); list.remove(res); //ok /* list.remove(res.takeOne); Error: function std.container.dlist.DList!int.DList.