Re: front evaluated multiple time with joiner depending on where extra arg given

2013-10-22 Thread Timothee Cour
> In general, if you want to do something once per element which involves > side > effects, I would advise using foreach rather than trying to put it into a > range. using foreach breaks UFCS chains, and also ElementType != ForeachType > But if you insist on doing so, the side effect should go

Re: Building derelict

2013-10-22 Thread Mike Parker
On Wednesday, 23 October 2013 at 00:59:28 UTC, bioinfornatics wrote: and i see like you that is a alias to a function i do not use this syntay usually so i am not able to understand what is the problem. I'm not on my dev box right now, but I took a look at the source at github and found

Re: front evaluated multiple time with joiner depending on where extra arg given

2013-10-22 Thread Jonathan M Davis
On Tuesday, October 22, 2013 19:54:18 Timothee Cour wrote: > > Certainly, I'd argue that it's generally better practice to do the work > > in popFront, because front does frequently gets called multiple times, and > > you > > almost always end up calling front if you call popFront. > > Actually, t

Re: front evaluated multiple time with joiner depending on where extra arg given

2013-10-22 Thread Timothee Cour
> > > Certainly, I'd argue that it's generally better practice to do the work > in popFront, because front does frequently gets called multiple times, and > you > almost always end up calling front if you call popFront. > Actually, the way phobos is designed, often times it's easier to specify wha

Re: Building derelict

2013-10-22 Thread bioinfornatics
On Tuesday, 22 October 2013 at 23:46:03 UTC, David Nadlinger wrote: On Tuesday, 22 October 2013 at 22:24:36 UTC, bioinfornatics wrote: derelict/pq/types.d(117): Error: struct derelict.pq.types.PGconn unknown size derelict/pq/types.d(117): Error: struct derelict.pq.types.PGconn no size yet for f

Re: front evaluated multiple time with joiner depending on where extra arg given

2013-10-22 Thread Jonathan M Davis
On Wednesday, October 23, 2013 02:21:55 bearophile wrote: > Timothee Cour: > > auto b=[1,2,3].map!(a=>{counter++; return > > > > [a];}()).joiner([0]).array; > > Currently there are some problems inside some of the higher order > functions of Phobos. So as general rule don't put impure code > insi

Re: front evaluated multiple time with joiner depending on where extra arg given

2013-10-22 Thread bearophile
Timothee Cour: auto b=[1,2,3].map!(a=>{counter++; return [a];}()).joiner([0]).array; Currently there are some problems inside some of the higher order functions of Phobos. So as general rule don't put impure code inside the functions (usually lambdas) you pass to the higher order functi

Re: Building derelict

2013-10-22 Thread David Nadlinger
On Tuesday, 22 October 2013 at 22:24:36 UTC, bioinfornatics wrote: derelict/pq/types.d(117): Error: struct derelict.pq.types.PGconn unknown size derelict/pq/types.d(117): Error: struct derelict.pq.types.PGconn no size yet for forward reference That's with LDC, right? We definitely need to imp

front evaluated multiple time with joiner depending on where extra arg given

2013-10-22 Thread Timothee Cour
Does that make sense? feature or bug? void main(){ import std.algorithm; import std.array; { int counter=0; auto b=[1,2,3].map!(a=>{counter++; return [a];}()).joiner([0]).array; assert(counter==3); } { int counter=0; auto b=[1,2,3].map!(a=>{counter++; return [a];}()).

Building derelict

2013-10-22 Thread bioinfornatics
Hi, That is now some time where i am not try to buld derelict3, Currently my build fail with: derelict/pq/types.d(117): Error: struct derelict.pq.types.PGconn unknown size derelict/pq/types.d(117): Error: struct derelict.pq.types.PGconn no size yet for forward reference Someone know what t

Re: Spawning a pty in D

2013-10-22 Thread Adam D. Ruppe
looking at the comments: //pragma(lib, "util"); // pragma does not work for me at moment. TODO: FIND OUT WHY! If you are using gdc, and I think ldc too, that pragma is unsupported since it doesn't fit well into the gcc code - there's no easy way to pass linker flags from the D frontend t

"extern" template instantiation

2013-10-22 Thread Mathias LANG
Hi everyone, This is going to be a silly question. I have the following files: -- heavy.d -- import std.regex; enum r = ctRegex!(r"^(\w+)\s+([a-zA-Z0-9/]+)\?a=(\w+)&b=(\w+)&c=(\w+)([&\D+=\w+)]*)&y=([0-9A-Fa-z]+)&z=([0-9A-Fa-z]+)$"); -- main.d -- import heavy; void main() {} -- test.d -- impor

Re: Spawning a pty in D

2013-10-22 Thread Colin Grogan
On Thursday, 17 October 2013 at 14:12:36 UTC, Adam D. Ruppe wrote: On Thursday, 17 October 2013 at 13:53:39 UTC, Colin Grogan wrote: Anyone have any experience with this? I actually have been writing a terminal emulator for the last few weeks https://github.com/adamdruppe/terminal-emulator

Re: Error: unsupported char 0x03

2013-10-22 Thread Ali Çehreli
On 10/22/2013 08:56 AM, Agustin wrote: > On Tuesday, 22 October 2013 at 15:16:17 UTC, bearophile wrote: >> John Colvin: >> >>> do you perhaps want to!string(id) ??? >> >> Or: >> >> id.text >> >> Bye, >> bearophile > > > I like id.text better than to!string, thanks Me too but the following looks

Re: Error: unsupported char 0x03

2013-10-22 Thread Agustin
On Tuesday, 22 October 2013 at 15:16:17 UTC, bearophile wrote: John Colvin: do you perhaps want to!string(id) ??? Or: id.text Bye, bearophile I like id.text better than to!string, thanks

Re: Error: unsupported char 0x03

2013-10-22 Thread bearophile
John Colvin: do you perhaps want to!string(id) ??? Or: id.text Bye, bearophile

Re: Error: unsupported char 0x03

2013-10-22 Thread John Colvin
On Tuesday, 22 October 2013 at 15:01:20 UTC, Agustin wrote: Trying to use mixin, i get an unsupported char error. protected template GenMessageGetId(uint id) { immutable string GenMessageGetId = "public immutable(int) getId() const { \n" ~ id ~ "; \n}"; } public mixin template Pac

Re: Error: unsupported char 0x03

2013-10-22 Thread Adam D. Ruppe
On Tuesday, 22 October 2013 at 15:01:20 UTC, Agustin wrote: = "public immutable(int) getId() const { \n" ~ id ~ "; \n}"; You'll probably want to convert id to a string there import std.conv; "public immutable(int) getId() const { \n" ~ to!string(id) ~ "; and also put in return for t

Re: Error: unsupported char 0x03

2013-10-22 Thread Agustin
On Tuesday, 22 October 2013 at 15:05:16 UTC, Adam D. Ruppe wrote: On Tuesday, 22 October 2013 at 15:01:20 UTC, Agustin wrote: = "public immutable(int) getId() const { \n" ~ id ~ "; \n}"; You'll probably want to convert id to a string there import std.conv; "public immutable(int) getI

Error: unsupported char 0x03

2013-10-22 Thread Agustin
Trying to use mixin, i get an unsupported char error. protected template GenMessageGetId(uint id) { immutable string GenMessageGetId = "public immutable(int) getId() const { \n" ~ id ~ "; \n}"; } public mixin template Packet(uint id, T...) { ... private static string build

Re: Error: unsupported char 0x03

2013-10-22 Thread Agustin
On Tuesday, 22 October 2013 at 15:01:20 UTC, Agustin wrote: Trying to use mixin, i get an unsupported char error. protected template GenMessageGetId(uint id) { immutable string GenMessageGetId = "public immutable(int) getId() const { \n" ~ id ~ "; \n}"; } public mixin template Pac

Re: Cannot alias expression

2013-10-22 Thread Timon Gehr
On 10/21/2013 02:58 PM, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template B(alias A) { alias B = A; } template C(A ...) { alias C = A[0]; } static assert(B!1 == 1); //fine static assert(C!1 == 1)

Re: Help with concurrency - traversing a DAG

2013-10-22 Thread tbttfox
On Friday, 18 October 2013 at 19:47:37 UTC, qznc wrote: Create a task for each node without a parent. Let the tasks create new tasks for their children. I was finally able to try this out, but I'm having a problem. My test case right now is a simple linked list, and what I think happens is tha