Re: std.process spawnShell/pipeShell dont capture output of the shell

2013-10-09 Thread Jesse Phillips
On Wednesday, 9 October 2013 at 14:54:32 UTC, Colin Grogan wrote: is blocking. However, its not meant to be blocking is it not? That new /bin/bash process is meant to run in parallel to the main process? I'm not sure exactly the implementation. But if you're asking to run bash and then print

Re: Error: struct Foo(T = int) is used as a type

2013-10-09 Thread Jared Miller
I wondered the same thing a couple of weeks back. It seems to work this way to avoid certain ambiguities. Related bug report / discussion: http://d.puremagic.com/issues/show_bug.cgi?id=1012

Re: mutable, const, immutable guidelines

2013-10-09 Thread qznc
On Wednesday, 9 October 2013 at 15:50:55 UTC, Daniel Davidson wrote: > I would rephrase the second guideline as: "Never dup or idup an argument > to make it mutable or immutable, but require the caller to do this > (might be able to avoid it)". Agreed. But it means you agree with me that immutab

Error: struct Foo(T = int) is used as a type

2013-10-09 Thread Namespace
import std.stdio; struct Foo(T = int) { } void main() { Foo f; } Error: Error: struct Foo(T = int) is used as a type If I change Foo f into Foo!() f it works. Is the compiler not able to see that this is not necessary, since I have a default type?

Re: mutable, const, immutable guidelines

2013-10-09 Thread qznc
On Wednesday, 9 October 2013 at 15:50:55 UTC, Daniel Davidson wrote: void foo(const(MutableType) mt); void foo(immutable(MutableType) mt); Naturally the inclination is to choose the second as it is a stronger guarantee that no threads are changing the data. Cool. But wait, the first one still

Re: auto attribute for interface functions

2013-10-09 Thread Jonathan M Davis
On Wednesday, October 09, 2013 16:13:48 Roman wrote: > > In fact, since the template could be in a library, and code > > could use that library well after the library has been > > written... > > As such, there is a fundamental conflict between how templates > > work and how virtual functions work.

Adaptation

2013-10-09 Thread Paolo Invernizzi
Hi all, I think this is not possible, but I'm using two different templated libraries, and I'm wondering if there's a way of adapting that: module external.foo; struct Foo { Foo[] foos } module external.spam; void spammer(T foolike){ foreach(s; foolike.spams){ ... } } mo

Re: Can someone explain why i can change this immutable variable please?

2013-10-09 Thread Gary Willoughby
On Wednesday, 9 October 2013 at 16:02:43 UTC, Daniel Davidson wrote: Maybe this will help explain it: void main() { pragma(msg, typeof(Bar.name)); pragma(msg, typeof(Foo.change)); } will print: immutable(char[][]) void(string[] name) The latter is really: void(immutable(char)[] name) The

Re: Can someone explain why i can change this immutable variable please?

2013-10-09 Thread Daniel Davidson
On Wednesday, 9 October 2013 at 15:33:23 UTC, Ali Çehreli wrote: That string is independent from the argument (i.e. Bar.name). They initially share the same characters. Either of those strings can leave this sharing at will, and that is exactly what name="tess" does. 'name' now refers to dif

Re: Can someone explain why i can change this immutable variable please?

2013-10-09 Thread Daniel Davidson
On Wednesday, 9 October 2013 at 15:46:29 UTC, Gary Willoughby wrote: So why does this give me an error i expect: import std.stdio; class Foo { public void change(string[] name) { name[0] = "tess";

Re: Can someone explain why i can change this immutable variable please?

2013-10-09 Thread Dicebot
D does stripping of qualifiers from top level when creating a copy which allows to pass immutable stuff as mutable parameter by value. Adding any single level of immutable indirection will make this impossible and result in compile-time error.

Re: mutable, const, immutable guidelines

2013-10-09 Thread Daniel Davidson
On Wednesday, 9 October 2013 at 04:41:35 UTC, Ali Çehreli wrote: On 10/08/2013 03:03 PM, qznc wrote: > On Wednesday, 2 October 2013 at 13:09:34 UTC, Daniel Davidson wrote: >> 1. If a variable is never mutated, make it const, not immutable. >> 2. Make the parameter reference to immutable if that

Re: Can someone explain why i can change this immutable variable please?

2013-10-09 Thread Gary Willoughby
On Wednesday, 9 October 2013 at 15:33:23 UTC, Ali Çehreli wrote: On 10/09/2013 08:26 AM, Gary Willoughby wrote: Can someone explain why i can change Bar's immutable name member please? import std.stdio; class Foo { public void change(string name) { name

Re: Can someone explain why i can change this immutable variable please?

2013-10-09 Thread Orvid King
On Wednesday, 9 October 2013 at 15:26:35 UTC, Gary Willoughby wrote: Can someone explain why i can change Bar's immutable name member please? import std.stdio; class Foo { public void change(string name) { name = "

Re: Can someone explain why i can change this immutable variable please?

2013-10-09 Thread Ali Çehreli
On 10/09/2013 08:26 AM, Gary Willoughby wrote: Can someone explain why i can change Bar's immutable name member please? import std.stdio; class Foo { public void change(string name) { name = "tess"; writeln(name); } }

Can someone explain why i can change this immutable variable please?

2013-10-09 Thread Gary Willoughby
Can someone explain why i can change Bar's immutable name member please? import std.stdio; class Foo { public void change(string name) { name = "tess"; writeln(name); }

Re: std.process spawnShell/pipeShell dont capture output of the shell

2013-10-09 Thread Colin Grogan
On Wednesday, 9 October 2013 at 14:27:30 UTC, Jesse Phillips wrote: On Wednesday, 9 October 2013 at 11:22:26 UTC, Colin Grogan wrote: " ~/test$ ./mess ls Executing: ls STDOUT: mess STDOUT: text.txt " Thats all fine, however, I'd expect it to print another "~/test$" at the end, as if its an int

Re: D scientifc paper

2013-10-09 Thread John Colvin
On Wednesday, 9 October 2013 at 14:34:05 UTC, bioinfornatics wrote: Dear, I am looking D scientific paper to read it flirstly and maybe cite it I found some old "paper" here: http://dl.acm.org/results.cfm?h=1&cfid=369177407&cftoken=46931292 thanks to report some link link's broken.

D scientifc paper

2013-10-09 Thread bioinfornatics
Dear, I am looking D scientific paper to read it flirstly and maybe cite it I found some old "paper" here: http://dl.acm.org/results.cfm?h=1&cfid=369177407&cftoken=46931292 thanks to report some link

Re: std.process spawnShell/pipeShell dont capture output of the shell

2013-10-09 Thread Jesse Phillips
On Wednesday, 9 October 2013 at 11:22:26 UTC, Colin Grogan wrote: " ~/test$ ./mess ls Executing: ls STDOUT: mess STDOUT: text.txt " Thats all fine, however, I'd expect it to print another "~/test$" at the end, as if its an interactive shell waiting for input. It is extracting the output of t

Re: auto attribute for interface functions

2013-10-09 Thread Roman
In fact, since the template could be in a library, and code could use that library well after the library has been written... As such, there is a fundamental conflict between how templates work and how virtual functions work. They just don't mix. Seems, the same problem doesn't allow auto attr

Re: mutable, const, immutable guidelines

2013-10-09 Thread Daniel Davidson
On Wednesday, 9 October 2013 at 04:31:55 UTC, Ali Çehreli wrote: On 10/08/2013 03:12 PM, qznc wrote: > On Monday, 7 October 2013 at 17:57:11 UTC, Ali Çehreli wrote: >> To look at just one usage example, the following line carries two >> requirements: >> >> auto a = T(); >> immutable b =

Re: template instance testA.FormatParser!(F) forward reference of variable F

2013-10-09 Thread ref2401
i've found the solution: void put(T)(T mesh) { static if (is(T : MyClass!F, string F)) { writeln("put method: ", F); } else { static assert(0, "Invalid type '" ~ std.traits.fullyQualifiedName!T ~ "'."); } }

std.process spawnShell/pipeShell dont capture output of the shell

2013-10-09 Thread Colin Grogan
Hi folks, Is there anyway to make std.process.spawnShell or std.process.pipeShell capture the output of the shell interface? For example, the code: import std.stdio; import std.process; void main(string[] args){ writefln("Executing: %s", args[1]); auto processPipes = pipeShell(args[1

Re: mutable, const, immutable guidelines

2013-10-09 Thread qznc
On Wednesday, 9 October 2013 at 04:41:35 UTC, Ali Çehreli wrote: > 4. Data structures should not restrict themselves to be mutable, const, > or immutable. What is the template of a struct that can be used as such? Providing simple values seems to be insufficient: struct MyInt { int i;