Re: retro() on a `string` creates a range of `dchar`, causing array() pains

2012-04-17 Thread Jakob Ovrum
On Tuesday, 17 April 2012 at 15:18:49 UTC, bearophile wrote: Jakob Ovrum: return array(strippedTail); } The type of the return expression is dstring, not string. What is the most elegant way or correct way to solve this friction? (Note: the function is used in CTFE)

Re: retro() on a `string` creates a range of `dchar`, causing array() pains

2012-04-17 Thread Jakob Ovrum
On Tuesday, 17 April 2012 at 15:36:39 UTC, Ali Çehreli wrote: The reason is, a sequence of UTF-8 code units are not a valid UTF-8 when reversed (or retro'ed :p). But a dchar array can be reversed. Ali It is absolutely possible to walk a UTF-8 string backwards. The problem here is that arr

Re: Not-so-unpredictable seed?

2012-04-17 Thread jerro
On Wednesday, 18 April 2012 at 05:05:20 UTC, Joseph Rushton Wakeling wrote: On 18/04/12 06:43, jerro wrote: According to the comment the call to prime() is necessary so that the result doesn't always start with the same element. But prime() uses the gen member which is only assigned after the c

Re: Not-so-unpredictable seed?

2012-04-17 Thread Joseph Rushton Wakeling
On 18/04/12 06:43, jerro wrote: According to the comment the call to prime() is necessary so that the result doesn't always start with the same element. But prime() uses the gen member which is only assigned after the constructor completes. So at the time when prime() is called the gen member is

Re: Not-so-unpredictable seed?

2012-04-17 Thread jerro
On Wednesday, 18 April 2012 at 03:47:31 UTC, Joseph Rushton Wakeling wrote: Can anyone explain to me why, when I compile & run this code, the two samples seeded with the unpredictableSeed always come out with the same starting value?

Re: appending newly initialized struct to array

2012-04-17 Thread Ali Çehreli
On 04/17/2012 02:00 PM, simendsjo wrote: > Sounds like a bug. C style initializers work in other cases: I try not to use them. I think they have this 'feature' of leaving unspecified members uninitialized: struct S { int i; double d; } void main() { S s = { 42 }; //

Re: Not-so-unpredictable seed?

2012-04-17 Thread jerro
On Wednesday, 18 April 2012 at 03:47:31 UTC, Joseph Rushton Wakeling wrote: Can anyone explain to me why, when I compile & run this code, the two samples seeded with the unpredictableSeed always come out with the same starting value?

Not-so-unpredictable seed?

2012-04-17 Thread Joseph Rushton Wakeling
Can anyone explain to me why, when I compile & run this code, the two samples seeded with the unpredictableSeed always come out with the same starting value? // import std.random, std.range, std.stdio; void main() { auto s = ra

Re: appending newly initialized struct to array

2012-04-17 Thread Kenji Hara
On Tuesday, 17 April 2012 at 21:00:55 UTC, simendsjo wrote: On Tue, 17 Apr 2012 22:28:31 +0200, maarten van damme wrote: Just for fun I decided to complete some codejam challenges in D. At some point I wanted to add structs to an array but I got a compiler error. What am I doing wrong? cod

Re: Sampling algorithms for D

2012-04-17 Thread Joseph Rushton Wakeling
On 13/04/12 10:04, Dmitry Olshansky wrote: OK, I'll see what I can do. I'd like to discuss and refine the design a bit further before making any pull request -- should I take things over to the Phobos mailing list for this ... ? I'm no authority but there is this d.D newsgroup which is perfectl

Re: Aquivalent References as in C++?

2012-04-17 Thread bearophile
Namespace: Another idea: instead scope, "in" can get a new functionality. Instead as a synonym for "const" it could mean "not null" for objects. Note that currently in D2 "in" means "scope const". Bye, bearophile

Re: Aquivalent References as in C++?

2012-04-17 Thread Namespace
Another idea: instead scope, "in" can get a new functionality. Instead as a synonym for "const" it could mean "not null" for objects.

Re: appending newly initialized struct to array

2012-04-17 Thread bearophile
simendsjo: Sounds like a bug. C style initializers work in other cases: D language is so much irregular, so many special cases that don't work :-) Bye, bearophile

Re: appending newly initialized struct to array

2012-04-17 Thread simendsjo
On Tue, 17 Apr 2012 22:28:31 +0200, maarten van damme wrote: Just for fun I decided to complete some codejam challenges in D. At some point I wanted to add structs to an array but I got a compiler error. What am I doing wrong? code: struct test{ int x; int y; } void main(){ test[] why; wh

Re: appending newly initialized struct to array

2012-04-17 Thread H. S. Teoh
On Tue, Apr 17, 2012 at 10:28:31PM +0200, maarten van damme wrote: > Just for fun I decided to complete some codejam challenges in D. At > some point I wanted to add structs to an array but I got a compiler > error. What am I doing wrong? > > code: > struct test{ > int x; > int y; > } > void main(

Re: Metaprogramming work around

2012-04-17 Thread Erèbe
On Tuesday, 17 April 2012 at 12:46:28 UTC, Kenji Hara wrote: On Tuesday, 17 April 2012 at 12:04:44 UTC, Erèbe wrote: [snip] There is something I still don't understand : mixin template Foo( T... ) { //Code here } mixin Foo!( "Hello", "Word" ); < Good T is TemplateTypeParameter, and matc

Re: retro() on a `string` creates a range of `dchar`, causing array()

2012-04-17 Thread bearophile
Ali Çehreli: Agreed. But I am not that sure about this particular function anymore because for the function to be not 'strongly exception safe', the input string must be invalid UTF-8 to begin with. I am not sure how bad it is to not preserve the actual invalidness of the string in that ca

appending newly initialized struct to array

2012-04-17 Thread maarten van damme
Just for fun I decided to complete some codejam challenges in D. At some point I wanted to add structs to an array but I got a compiler error. What am I doing wrong? code: struct test{ int x; int y; } void main(){ test[] why; why~={3,5}; } error: wait.d(7): found '}' when expecting ';' following

Re: Aquivalent References as in C++?

2012-04-17 Thread Namespace
On Tuesday, 17 April 2012 at 19:56:11 UTC, Timon Gehr wrote: On 04/17/2012 09:16 PM, Namespace wrote: But C++ does not do that either. Are you asking for a full-blown non-null type system? Yes, but of course only with a special Keyword/Storage class. If it is not the default, how would you e

Re: retro() on a `string` creates a range of `dchar`, causing array()

2012-04-17 Thread Ali Çehreli
On 04/17/2012 12:57 PM, bearophile wrote: >> The algorithm >> above is not exception-safe because stride() may throw. But this way off >> topic on this thread. :) > > You can't expect Phobos to be perfect, it needs to be improved > iteratively. If you think that's not exception safe and and ther

Re: retro() on a `string` creates a range of `dchar`, causing array()

2012-04-17 Thread bearophile
Ali: > The algorithm is smart. The basic idea for that algorithm was mine, and Andrei was very gentle to implement it, defining it a "Very fun exercise" :-) http://d.puremagic.com/issues/show_bug.cgi?id=7086 > The algorithm > above is not exception-safe because stride() may throw. But this way

Re: Aquivalent References as in C++?

2012-04-17 Thread Timon Gehr
On 04/17/2012 09:16 PM, Namespace wrote: But C++ does not do that either. Are you asking for a full-blown non-null type system? Yes, but of course only with a special Keyword/Storage class. If it is not the default, how would you enforce it at the caller side?

Re: Hacking on Phobos

2012-04-17 Thread Dmitry Olshansky
On 17.04.2012 23:27, Joseph Rushton Wakeling wrote: On 17/04/12 20:29, Dmitry Olshansky wrote: First things first - development of phobos is done with dmd. Just because gdc is (logically so) somewhat behind dmd and new compiler features are still coming with every release. Fair enough. I've fo

Re: Hacking on Phobos

2012-04-17 Thread Joseph Rushton Wakeling
On 17/04/12 20:47, H. S. Teoh wrote: The convention is to create a branch for making changes, this way it's very easy to generate pull requests on github if you ever wanted to contribute your code to the official codebase. Branches are super-cheap in git anyway, and you can edit source files to y

Re: Hacking on Phobos

2012-04-17 Thread Joseph Rushton Wakeling
On 17/04/12 20:29, Dmitry Olshansky wrote: First things first - development of phobos is done with dmd. Just because gdc is (logically so) somewhat behind dmd and new compiler features are still coming with every release. Fair enough. I've followed the instructions here: https://xtzgzorex.word

Re: Aquivalent References as in C++?

2012-04-17 Thread Namespace
But C++ does not do that either. Are you asking for a full-blown non-null type system? Yes, but of course only with a special Keyword/Storage class.

Re: Aquivalent References as in C++?

2012-04-17 Thread Timon Gehr
On 04/17/2012 08:40 PM, Namespace wrote: Define 'ensure'. Guarantee, that the given object parameter isn't a null reference. But C++ does not do that either. Are you asking for a full-blown non-null type system?

Re: Hacking on Phobos

2012-04-17 Thread H. S. Teoh
On Tue, Apr 17, 2012 at 10:29:24PM +0400, Dmitry Olshansky wrote: > On 17.04.2012 22:10, Joseph Rushton Wakeling wrote: > >Hello all, > > > >As per earlier discussion I'm trying to hack on Phobos to update the > >random sampling code. > > > >To do this I've just copied random.d into a new file, ran

Re: Aquivalent References as in C++?

2012-04-17 Thread Namespace
Define 'ensure'. Guarantee, that the given object parameter isn't a null reference.

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: Hacking on Phobos

2012-04-17 Thread Dmitry Olshansky
On 17.04.2012 22:10, Joseph Rushton Wakeling wrote: Hello all, As per earlier discussion I'm trying to hack on Phobos to update the random sampling code. To do this I've just copied random.d into a new file, randomsample.d, which I'm modifying and messing around with; I'm trying to build agains

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: Hacking on Phobos

2012-04-17 Thread Jonathan M Davis
On Tuesday, April 17, 2012 20:10:51 Joseph Rushton Wakeling wrote: > Hello all, > > As per earlier discussion I'm trying to hack on Phobos to update the random > sampling code. > > To do this I've just copied random.d into a new file, randomsample.d, which > I'm modifying and messing around with;

Re: Aquivalent References as in C++?

2012-04-17 Thread Timon Gehr
On 04/17/2012 08:10 PM, Namespace wrote: > Best of all solutions would be that a > special keyword, for example scope, ensure that lvalues would except but > _no_ null-references. Yes, the keyword would be a little shorter than the assert() or enforce() above but D already has very many keywords

Re: Aquivalent References as in C++?

2012-04-17 Thread Namespace
> Best of all solutions would be that a > special keyword, for example scope, ensure that lvalues would except but > _no_ null-references. Yes, the keyword would be a little shorter than the assert() or enforce() above but D already has very many keywords. :) Yes, but scope is an unused storag

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(

Hacking on Phobos

2012-04-17 Thread Joseph Rushton Wakeling
Hello all, As per earlier discussion I'm trying to hack on Phobos to update the random sampling code. To do this I've just copied random.d into a new file, randomsample.d, which I'm modifying and messing around with; I'm trying to build against a local copy of the GitHub Phobos sources. Wh

Re: Range returned by iota and const

2012-04-17 Thread Jonathan M Davis
On Tuesday, April 17, 2012 19:22:30 André Stein wrote: > Hi, > > I'm trying to pass the range returned by iota to a function accepting > the parameter as const. I got compilation errors when trying to use the > index operator and after some investigation it turned out that opSlice > of iota.Result

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: Aquivalent References as in C++?

2012-04-17 Thread Ali Çehreli
On 04/17/2012 10:37 AM, Namespace wrote: >> Yes, you must because whetheer obj is null is only known at runtime. > > Yes, but if i forget the assert i get an Access Violation error with no > more informations. Problem is nobody knows _why_ he gets this error, > because the error message gives no i

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: Aquivalent References as in C++?

2012-04-17 Thread Namespace
Yes, you must because whetheer obj is null is only known at runtime. Yes, but if i forget the assert i get an Access Violation error with no more informations. Problem is nobody knows _why_ he gets this error, because the error message gives no information. So it must be a better solution then

Range returned by iota and const

2012-04-17 Thread André Stein
Hi, I'm trying to pass the range returned by iota to a function accepting the parameter as const. I got compilation errors when trying to use the index operator and after some investigation it turned out that opSlice of iota.Result isn't declared as const. The function body of opSlice of iot

Re: Aquivalent References as in C++?

2012-04-17 Thread Namespace
For that, you have static if contitions, and indeed you can make it a compile-time error. Can you show me this as code? And are there any plans to realize non-null references or strategies to avoid such things? Otherwise there would really be something important missing in D.

Re: retro() on a `string` creates a range of `dchar`, causing array() pains

2012-04-17 Thread Ali Çehreli
On 04/17/2012 09:12 AM, Timon Gehr wrote: > On 04/17/2012 06:09 PM, Ali Çehreli wrote: >> The algorithm must be building a local string. > It does not have to build a local string, see > http://dlang.org/phobos/std_utf.html#strideBack I never said otherwise. :p I was too lazy to locate where 2

Re: retro() on a `string` creates a range of `dchar`, causing array() pains

2012-04-17 Thread Timon Gehr
On 04/17/2012 06:09 PM, Ali Çehreli wrote: On 04/17/2012 08:58 AM, bearophile wrote: > Ali Çehreli: > >> The reason is, a sequence of UTF-8 code units are not a valid UTF-8 >> when reversed (or retro'ed :p). > > But reversed(char[]) now works :-) That's pretty cool. :) (You meant reverse()

Re: retro() on a `string` creates a range of `dchar`, causing array() pains

2012-04-17 Thread Ali Çehreli
On 04/17/2012 08:58 AM, bearophile wrote: > Ali Çehreli: > >> The reason is, a sequence of UTF-8 code units are not a valid UTF-8 >> when reversed (or retro'ed :p). > > But reversed(char[]) now works :-) That's pretty cool. :) (You meant reverse()). Interesting, because there could be no other w

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: retro() on a `string` creates a range of `dchar`, causing array() pains

2012-04-17 Thread bearophile
Ali Çehreli: The reason is, a sequence of UTF-8 code units are not a valid UTF-8 when reversed (or retro'ed :p). But reversed(char[]) now works :-) Bye, bearophile

Re: Aquivalent References as in C++?

2012-04-17 Thread Ali Çehreli
On 04/17/2012 08:49 AM, Ali Çehreli wrote: > That fails because null is a compile time value and you have a special > template code for that that fails the compilation. Scratch the 'template' part. You don't have templates there but what I said is still valid. Basically, you have some code that

Re: Aquivalent References as in C++?

2012-04-17 Thread Ali Çehreli
On 04/17/2012 02:39 AM, Namespace wrote: >> Bar b = new Bar(42); >> >> new Foo(b); // works >> new Foo(null); // compiler error That fails because null is a compile time value and you have a special template code for that that fails the compilation. >> new Foo(Bar(23)); // works >> new Foo(Ba

Re: retro() on a `string` creates a range of `dchar`, causing array() pains

2012-04-17 Thread Ali Çehreli
On 04/17/2012 08:12 AM, Jakob Ovrum wrote: > Consider this simple function: > > private string findParameterList(string typestr) > { > auto strippedHead = typestr.find("(")[1 .. $]; > auto strippedTail = retro(strippedHead).find(")"); > > strippedTail.popFront(); // slice off closing parenthesis >

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: Aquivalent References as in C++?

2012-04-17 Thread Dejan Lekic
On Tuesday, 17 April 2012 at 09:39:10 UTC, Namespace wrote: On Tuesday, 17 April 2012 at 08:02:02 UTC, Namespace wrote: Now i have something like this. It works and manipulates lvalues so that i can pass my objects by ref to except null. But is this smart? class Bar { public: int x;

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: "shared" status

2012-04-17 Thread Dejan Lekic
On Saturday, 14 April 2012 at 10:48:16 UTC, Luis Panadero Guardeño wrote: What is the status of "shared" types ? I try it with gdmd v4.6.3 And I not get any warring/error when I do anything over a shared variable without using atomicOp. It's normal ? shared ushort ram[ram_size]; ram

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: retro() on a `string` creates a range of `dchar`, causing array() pains

2012-04-17 Thread bearophile
Jakob Ovrum: return array(strippedTail); } The type of the return expression is dstring, not string. What is the most elegant way or correct way to solve this friction? (Note: the function is used in CTFE) Try "text" instead of "array". Bye, bearophile

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: "No stack address"

2012-04-17 Thread Andrej Mitrovic
On 4/17/12, Somedude wrote: > Do you have any idea where this is explained rdmd --help

retro() on a `string` creates a range of `dchar`, causing array() pains

2012-04-17 Thread Jakob Ovrum
Consider this simple function: private string findParameterList(string typestr) { auto strippedHead = typestr.find("(")[1 .. $]; auto strippedTail = retro(strippedHead).find(")"); strippedTail.popFront(); // slice off closing parent

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: arrays and foreach

2012-04-17 Thread Ali Çehreli
On 04/17/2012 12:42 AM, Somedude wrote: Sorry for hijacking this thread, but since you're around, I hope you'll see this message. As a D beginner, I'm browsing through your book. I wanted to tell you that there is something essential missing in it: how to compile. It's actually quite hard to fin

Re: "shared" status

2012-04-17 Thread Ali Çehreli
On 04/17/2012 06:05 AM, Luis wrote: Thanks! It's very useful. Ali Çehreli wrote: synchronized (job) { *job.slice ~= appendValue; } So shared, at least share data across threads. And using synchronized( ) I could do lock-based access to shared data. Yes. I've used the same Job object there

Re: "shared" status

2012-04-17 Thread Luis
Thanks! It's very useful. Ali Çehreli wrote: > synchronized (job) { > *job.slice ~= appendValue; > } So shared, at least share data across threads. And using synchronized( ) I could do lock-based access to shared data.

Re: "No stack address"

2012-04-17 Thread Somedude
Le 17/04/2012 09:30, Somedude a écrit : > Anyway, I think I'll add this simple piece of info somewhere in the > wiki. I've already cleaned it up a little. Ok, here it is: http://prowiki.org/wiki4d/wiki.cgi?HowTo/UnitTests

Re: Metaprogramming work around

2012-04-17 Thread Kenji Hara
On Tuesday, 17 April 2012 at 12:04:44 UTC, Erèbe wrote: [snip] There is something I still don't understand : mixin template Foo( T... ) { //Code here } mixin Foo!( "Hello", "Word" ); < Good T is TemplateTypeParameter, and matches any kind of template arguments - types, values, and symbo

Re: Compiling Was: arrays and foreach

2012-04-17 Thread David
In this case, I had to type: rdmd -unittest --main test.d Without the --main, I would get linker errors, and couldn't find the reason for these errors. Happily, someone here explained me that the effect of the --main flag was to insert a main() function just for this case. That's not surprising

Re: Metaprogramming work around

2012-04-17 Thread Erèbe
On Tuesday, 17 April 2012 at 10:29:56 UTC, Kenji Hara wrote: On Tuesday, 17 April 2012 at 08:28:45 UTC, Erèbe wrote: Hi, I'm working on some metaprogramming code which implement a Factory and generate an enum from a list of string. So here my questions : 1) The documentation say mixin templ

Re: Compiling Was: arrays and foreach

2012-04-17 Thread Somedude
Le 17/04/2012 12:19, Mike Parker a écrit : > On 4/17/2012 4:42 PM, Somedude wrote: > >>> >>> Ali >>> >>> >> Hi Ali, >> >> Sorry for hijacking this thread, but since you're around, I hope you'll >> see this message. As a D beginner, I'm browsing through your book. >> I wanted to tell you that there

Re: Metaprogramming work around

2012-04-17 Thread Dmitry Olshansky
On 17.04.2012 12:28, "Erèbe" wrote: Hi, I'm working on some metaprogramming code which implement a Factory and generate an enum from a list of string. So here my questions : 1) The documentation say mixin templates could take as TemplateParameterList a "TemplateParameter , TemplateParameterLis

Re: Metaprogramming work around

2012-04-17 Thread Kenji Hara
On Tuesday, 17 April 2012 at 08:28:45 UTC, Erèbe wrote: Hi, I'm working on some metaprogramming code which implement a Factory and generate an enum from a list of string. So here my questions : 1) The documentation say mixin templates could take as TemplateParameterList a "TemplateParameter

Compiling Was: arrays and foreach

2012-04-17 Thread Mike Parker
On 4/17/2012 4:42 PM, Somedude wrote: Ali Hi Ali, Sorry for hijacking this thread, but since you're around, I hope you'll see this message. As a D beginner, I'm browsing through your book. I wanted to tell you that there is something essential missing in it: how to compile. It's actually qu

Re: Aquivalent References as in C++?

2012-04-17 Thread Namespace
On Tuesday, 17 April 2012 at 08:02:02 UTC, Namespace wrote: Now i have something like this. It works and manipulates lvalues so that i can pass my objects by ref to except null. But is this smart? class Bar { public: int x; static ref Bar opCall(int x) {

Metaprogramming work around

2012-04-17 Thread Erèbe
Hi, I'm working on some metaprogramming code which implement a Factory and generate an enum from a list of string. So here my questions : 1) The documentation say mixin templates could take as TemplateParameterList a "TemplateParameter , TemplateParameterList" but all my tried to instaciate

Re: Thread join behaviour

2012-04-17 Thread Somedude
Le 17/04/2012 08:40, Russel Winder a écrit : > On Mon, 2012-04-16 at 21:03 +0200, Somedude wrote: > [...] > > Issue 7919 > > http://d.puremagic.com/issues/show_bug.cgi?id=7919 > Thanks.

Re: Aquivalent References as in C++?

2012-04-17 Thread Namespace
Now i have something like this. It works and manipulates lvalues so that i can pass my objects by ref to except null. But is this smart? class Bar { public: int x; static ref Bar opCall(int x) { static Bar b; b = new Bar(

Re: arrays and foreach

2012-04-17 Thread Somedude
Le 17/04/2012 02:01, Ali Çehreli a écrit : > On 04/16/2012 04:56 PM, darkstalker wrote: >> i have this example program: >> >> --- >> void main() >> { >> int[3] a; >> foreach (p; a) >> p = 42; >> writeln(a); >> } >> --- >> >> after running it, i expect to get [42, 42, 42] but instead i get [0, 0, >>

Re: "No stack address"

2012-04-17 Thread Somedude
Le 17/04/2012 01:26, Andrej Mitrovic a écrit : > On 4/17/12, Somedude wrote: >> But running the exe crashes immediately at execution with "unauthorized >> instruction". Why ? > > That's the old exectuable leftover from the previous compile. RDMD > generates the exe in a temporary folder with a ra