Re: package access specifier not usable within a class

2011-09-08 Thread Andrej Mitrovic
Thanks. I'll refactor my code to eliminate the need for package in this case. I was going to use it as a quick workaround anyway. :)

Re: package access specifier not usable within a class

2011-09-08 Thread Jonathan M Davis
On Friday, September 09, 2011 03:05:05 Andrej Mitrovic wrote: > abstract class Foo > { > package void test(); > } > > class Bar : Foo > { > override package void test() { } > } > > function test.Bar.test cannot override a non-virtual function > > TDPL says package can only be used at cla

package access specifier not usable within a class

2011-09-08 Thread Andrej Mitrovic
abstract class Foo { package void test(); } class Bar : Foo { override package void test() { } } function test.Bar.test cannot override a non-virtual function TDPL says package can only be used at class-level (i.e. package class Bar : Foo), outside classes or inside a struct. I want to

Re: Any python-like generator patterns in D?

2011-09-08 Thread Samuel Lampa
Many thanks! I'll check these links. // Samuel On 09/08/2011 07:47 PM, Ali Çehreli wrote: On Thu, 08 Sep 2011 13:35:02 +0200, Samuel Lampa wrote: Hi, I found these slides very interesting, on how python generator patterns can be used to create re-usable code-parts that can be "piped" togegh

Re: How would I retrieve the stdout error message of a system/shell command?

2011-09-08 Thread Andrej Mitrovic
On 9/8/11, Steven Schveighoffer wrote: > This is the plan for the revamped version of std.process, which is held up > waiting for DMC changes. That's good news, thanks. I'll try the various pipe/redirect methods soon.

Re: How would I retrieve the stdout error message of a system/shell command?

2011-09-08 Thread Timon Gehr
On 09/08/2011 08:21 PM, Justin Whear wrote: Good point. It looks like shell throws if the return value is an error code (something other than 0 on Posix). It looks like dmd does return an error code on failed compilation, so redirecting to stdout won't work. Back to the pipes or file redirect the

Re: How would I retrieve the stdout error message of a system/shell command?

2011-09-08 Thread Justin Whear
Good point. It looks like shell throws if the return value is an error code (something other than 0 on Posix). It looks like dmd does return an error code on failed compilation, so redirecting to stdout won't work. Back to the pipes or file redirect then. Christophe wrote: > Justin Whear , da

Re: How would I retrieve the stdout error message of a system/shell command?

2011-09-08 Thread Steven Schveighoffer
On Thu, 08 Sep 2011 14:14:40 -0400, Justin Whear wrote: For posterity's sake, the "correct" (and much more complicated way) is to use pipes and fork(). Here's a Posix-only implementation I wrote a while ago: http://pastebin.com/CBYw4fDU No guarantees on the code, but it demonstrates how to s

Re: How would I retrieve the stdout error message of a system/shell command?

2011-09-08 Thread Christophe
Justin Whear , dans le message (digitalmars.D.learn:29380), a écrit : > That'll work if you don't mind normal output being mixed with error > messages. > > > Timon Gehr wrote: > >> On 09/08/2011 07:26 PM, Justin Whear wrote: >>> The Posix solution is to use pipes. Basically, you'll want the par

Re: How would I retrieve the stdout error message of a system/shell command?

2011-09-08 Thread Justin Whear
For posterity's sake, the "correct" (and much more complicated way) is to use pipes and fork(). Here's a Posix-only implementation I wrote a while ago: http://pastebin.com/CBYw4fDU No guarantees on the code, but it demonstrates how to set up the pipes, etc. The cool thing is that it supports fu

Re: How would I retrieve the stdout error message of a system/shell command?

2011-09-08 Thread Justin Whear
That'll work if you don't mind normal output being mixed with error messages. Timon Gehr wrote: > On 09/08/2011 07:26 PM, Justin Whear wrote: >> The Posix solution is to use pipes. Basically, you'll want the parent >> process to set up a pipe for stderr, fork, then the child process uses >> the

Re: How would I retrieve the stdout error message of a system/shell command?

2011-09-08 Thread Timon Gehr
On 09/08/2011 07:26 PM, Justin Whear wrote: The Posix solution is to use pipes. Basically, you'll want the parent process to set up a pipe for stderr, fork, then the child process uses the write end of the stderr while the parent reads from the other end. Not sure what the Windoze solution is. Al

Re: Any python-like generator patterns in D?

2011-09-08 Thread Ali Çehreli
On Thu, 08 Sep 2011 13:35:02 +0200, Samuel Lampa wrote: > Hi, > > I found these slides very interesting, on how python generator patterns > can be used to create re-usable code-parts that can be "piped" togegher > ad infinitum, to create e.g. parsing pipelines requiring minimal memory > (things a

Re: How would I retrieve the stdout error message of a system/shell command?

2011-09-08 Thread Justin Whear
The Posix solution is to use pipes. Basically, you'll want the parent process to set up a pipe for stderr, fork, then the child process uses the write end of the stderr while the parent reads from the other end. Not sure what the Windoze solution is. Alternatively, the cheap and easy way is to u

Any python-like generator patterns in D?

2011-09-08 Thread Samuel Lampa
Hi, I found these slides very interesting, on how python generator patterns can be used to create re-usable code-parts that can be "piped" togegher ad infinitum, to create e.g. parsing pipelines requiring minimal memory (things a sysadmin working with huge files might need quite often): http://ww

Re: A small trouble with std.range.indexed

2011-09-08 Thread bearophile
Ali Çehreli: > The documentation of indexed() says: "Source must be a random access > range. The returned range will be bidirectional or random-access if > Indices is bidirectional or random-access, respectively." > Because idxSet is not RandomAccessRange, indexed() does not provide > opIndex(

Re: A small trouble with std.range.indexed

2011-09-08 Thread Ali Çehreli
On Thu, 08 Sep 2011 03:33:24 -0400, bearophile wrote: > std.range.indexed of DMD 2.055 is very nice. But it signature shows > constraints that I have had problems to work with, maybe the error is > just mine, I don't know: > > > import std.algorithm, std.range, std.array; void main() { > aut

How would I retrieve the stdout error message of a system/shell command?

2011-09-08 Thread Andrej Mitrovic
E.g.: import std.process; void main() { auto res = shell("dmd bla.d"); } where bla.d doesn't exist. This will throw an exception, but even if I caught the exception I will still loose the error message. Is there any way I could grab the error message? In this case it would be: "std.exceptio

Re: DMD 2.055

2011-09-08 Thread bearophile
Johannes Pfau: > I assume the problem is in line 22 of the code you posted? As a > workaround, try to explicitly cast the delegates to the same type: > > [cast(string delegate(string))(string text) { return toLower(text); }, > cast(string delegate(string))(string text) { return > wipeOutChars(t

Re: DMD 2.055

2011-09-08 Thread Joel Christensen
On 08-Sep-11 9:05 PM, Johannes Pfau wrote: cast(string delegate(string)) Thanks Johannes, that's better than my way. :-) - Joelcnz

Re: DMD 2.055

2011-09-08 Thread Joel Christensen
Also I can't compile programs like this any more: \D\dmd2\windows\bin\dmd file1 file2 etc. I've been using Geany (a light IDE), now I have to use the terminal to compile my programs (also clicking on a batch file), before I could compile with the hit of a key. Actually I fix my problem in my

A small trouble with std.range.indexed

2011-09-08 Thread bearophile
std.range.indexed of DMD 2.055 is very nice. But it signature shows constraints that I have had problems to work with, maybe the error is just mine, I don't know: import std.algorithm, std.range, std.array; void main() { auto data = [7, 6, 5, 4, 3, 2, 1, 0]; auto indices = [6, 1, 7];