Re: Templates in classes => what is wrong?

2012-04-18 Thread Xan
On Tuesday, 17 April 2012 at 18:39:16 UTC, Xan wrote: On Tuesday, 17 April 2012 at 18:25:21 UTC, Ali Çehreli wrote: On 04/17/2012 11:13 AM, Xan wrote: > The idea is behind this https://gist.github.com/2407923 > But I receive: > > $ gdmd-4.6 algorisme_code.d > algorisme_code.d:22: Error: variabl

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 18:25:21 UTC, Ali Çehreli wrote: On 04/17/2012 11:13 AM, Xan wrote: > The idea is behind this https://gist.github.com/2407923 > But I receive: > > $ gdmd-4.6 algorisme_code.d > algorisme_code.d:22: Error: variable codi cannot be read at compile time > algorisme_code.

Re: Templates in classes => what is wrong?

2012-04-17 Thread Ali Çehreli
On 04/17/2012 11:13 AM, Xan wrote: > The idea is behind this https://gist.github.com/2407923 > But I receive: > > $ gdmd-4.6 algorisme_code.d > algorisme_code.d:22: Error: variable codi cannot be read at compile time > algorisme_code.d:22: Error: argument to mixin must be a string, not (codi)

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 18:00:55 UTC, Xan wrote: On Tuesday, 17 April 2012 at 15:59:25 UTC, Ali Çehreli wrote: On 04/17/2012 08:42 AM, Xan wrote: > How to get the "code" of a function or delegate > > |___string toString() { > |___|___return format("%s (versió %s): Domini -> Recorregut, %s(

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 18:00:55 UTC, Xan wrote: On Tuesday, 17 April 2012 at 15:59:25 UTC, Ali Çehreli wrote: On 04/17/2012 08:42 AM, Xan wrote: > How to get the "code" of a function or delegate > > |___string toString() { > |___|___return format("%s (versió %s): Domini -> Recorregut, %s(

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 15:59:25 UTC, Ali Çehreli wrote: On 04/17/2012 08:42 AM, Xan wrote: > How to get the "code" of a function or delegate > > |___string toString() { > |___|___return format("%s (versió %s): Domini -> Recorregut, %s(x) = > %s", nom, versio, nom, &funcio); > > |___} > > d

Re: Templates in classes => what is wrong?

2012-04-17 Thread Ali Çehreli
On 04/17/2012 08:42 AM, Xan wrote: > How to get the "code" of a function or delegate > > |___string toString() { > |___|___return format("%s (versió %s): Domini -> Recorregut, %s(x) = > %s", nom, versio, nom, &funcio); > > |___} > > does not produce the desired result and &funcio without ampersan

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 15:30:36 UTC, Ali Çehreli wrote: On 04/17/2012 08:17 AM, Xan wrote: Off-topic, could can I define toString having this structure: (versió ): -> , ? (For example, in https://gist.github.com/2394274 I want that Doblar displays as: Doblar (versió 1): int -> in

Re: Templates in classes => what is wrong?

2012-04-17 Thread Ali Çehreli
On 04/17/2012 08:17 AM, Xan wrote: Off-topic, could can I define toString having this structure: (versió ): -> , ? (For example, in https://gist.github.com/2394274 I want that Doblar displays as: Doblar (versió 1): int -> int, { return 2 * a; } Thanks a lot, Xan. std.string.format is ea

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 15:21:30 UTC, Dejan Lekic wrote: On Tuesday, 17 April 2012 at 14:57:18 UTC, Xan wrote: On Tuesday, 17 April 2012 at 01:31:43 UTC, Kenji Hara wrote: On Monday, 16 April 2012 at 18:48:52 UTC, Xan wrote: On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote: On

Re: Templates in classes => what is wrong?

2012-04-17 Thread Dejan Lekic
On Tuesday, 17 April 2012 at 14:57:18 UTC, Xan wrote: On Tuesday, 17 April 2012 at 01:31:43 UTC, Kenji Hara wrote: On Monday, 16 April 2012 at 18:48:52 UTC, Xan wrote: On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote: On 04/15/2012 11:39 AM, Xan wrote: > On Sunday, 15 April 2012 at

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
Off-topic, could can I define toString having this structure: (versió ): -> , ? (For example, in https://gist.github.com/2394274 I want that Doblar displays as: Doblar (versió 1): int -> int, { return 2 * a; } Thanks a lot, Xan.

Re: Templates in classes => what is wrong?

2012-04-17 Thread Xan
On Tuesday, 17 April 2012 at 01:31:43 UTC, Kenji Hara wrote: On Monday, 16 April 2012 at 18:48:52 UTC, Xan wrote: On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote: On 04/15/2012 11:39 AM, Xan wrote: > On Sunday, 15 April 2012 at 11:23:37 UTC, John Chapman > wrote: >> On Sunday, 15

Re: Templates in classes => what is wrong?

2012-04-16 Thread Kenji Hara
On Monday, 16 April 2012 at 18:48:52 UTC, Xan wrote: On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote: On 04/15/2012 11:39 AM, Xan wrote: > On Sunday, 15 April 2012 at 11:23:37 UTC, John Chapman wrote: >> On Sunday, 15 April 2012 at 11:16:43 UTC, Xan wrote: >>> >>> int main(string []

Re: Templates in classes => what is wrong?

2012-04-16 Thread Ali Çehreli
On 04/16/2012 11:48 AM, Xan wrote: On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote: On 04/15/2012 11:39 AM, Xan wrote: > On Sunday, 15 April 2012 at 11:23:37 UTC, John Chapman wrote: >> On Sunday, 15 April 2012 at 11:16:43 UTC, Xan wrote: >>> >>> int main(string [] args) >>> { >>> au

Re: Templates in classes => what is wrong?

2012-04-16 Thread Xan
On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote: On 04/15/2012 11:39 AM, Xan wrote: > On Sunday, 15 April 2012 at 11:23:37 UTC, John Chapman wrote: >> On Sunday, 15 April 2012 at 11:16:43 UTC, Xan wrote: >>> >>> int main(string [] args) >>> { >>> auto alg = Algorisme!(int,int); >> >>

Re: Templates in classes => what is wrong?

2012-04-15 Thread Ali Çehreli
On 04/15/2012 01:27 PM, jerro wrote: - Return 0 from main() for successful exit, anything else by convention means some sort of error. Why not just declare main return type to be void? That's much better. :) D takes care of doing the right thing in that case. Ali

Re: Templates in classes => what is wrong?

2012-04-15 Thread jerro
- Return 0 from main() for successful exit, anything else by convention means some sort of error. Why not just declare main return type to be void?

Re: Templates in classes => what is wrong?

2012-04-15 Thread Ali Çehreli
On 04/15/2012 11:39 AM, Xan wrote: > On Sunday, 15 April 2012 at 11:23:37 UTC, John Chapman wrote: >> On Sunday, 15 April 2012 at 11:16:43 UTC, Xan wrote: >>> >>> int main(string [] args) >>> { >>> auto alg = Algorisme!(int,int); >> >> Should be: >> auto alg = new Algorisme!(int, int); >> >>> alg.

Re: Templates in classes => what is wrong?

2012-04-15 Thread Xan
On Sunday, 15 April 2012 at 11:23:37 UTC, John Chapman wrote: On Sunday, 15 April 2012 at 11:16:43 UTC, Xan wrote: int main(string [] args) { auto alg = Algorisme!(int,int); Should be: auto alg = new Algorisme!(int, int); alg.nom = "Doblar"; alg.versio = 1; alg.funcio = (i

Re: Templates in classes => what is wrong?

2012-04-15 Thread John Chapman
On Sunday, 15 April 2012 at 11:16:43 UTC, Xan wrote: int main(string [] args) { auto alg = Algorisme!(int,int); Should be: auto alg = new Algorisme!(int, int); alg.nom = "Doblar"; alg.versio = 1; alg.funcio = (int a) {return 2*a}; Should be: alg.funcio = (int a)

Templates in classes => what is wrong?

2012-04-15 Thread Xan
hi, I have this code: import std.conv, std.stdio, std.stream, std.string; import std.socket, std.socketstream; import std.datetime; class Algorisme(U,V) { string nom; uint versio; V delegate (U) funcio; } int main(string [] args) { auto alg = Algorisme!(int,int); alg.nom =