Re: Narrow string is not a random access range

2012-10-23 Thread Simen Kjaeraas
On 2012-41-24 01:10, Adam D. Ruppe wrote: On Tuesday, 23 October 2012 at 23:07:28 UTC, Jonathan M Davis wrote: I think that Andrei was arguing for changing how the compiler itself handles arrays of char and wchar so that they wouldn't As I said last time this came up, we could actually do t

Re: More automated interfacing of D with C codebases

2012-10-23 Thread Jacob Carlborg
On 2012-10-23 21:43, Brad Lanam wrote: Oh, maybe were you thinking that bash is the bourne shell? It's the bourne-again shell, a rewrite of the bourne shell. Solaris sh is probably the closest to the original bourne shell. I thought I said bash somewhere, but perhaps you didn't. My tool ru

Re: long compile time question

2012-10-23 Thread 1100110
On Tue, 23 Oct 2012 22:50:46 -0500, Dan wrote: The following takes nearly three minutes to compile. The culprit is the line bar ~= B(); What is wrong with this? Thanks, Dan struct B { const size_t SIZE = 1024*64; int[SIZE] x; } void main() { B[] barr; barr ~= B();

long compile time question

2012-10-23 Thread Dan
The following takes nearly three minutes to compile. The culprit is the line bar ~= B(); What is wrong with this? Thanks, Dan struct B { const size_t SIZE = 1024*64; int[SIZE] x; } void main() { B[] barr; barr ~= B(); } -

Re: exception messages

2012-10-23 Thread H. S. Teoh
On Wed, Oct 24, 2012 at 03:03:02AM +0200, Andrej Mitrovic wrote: > On 10/24/12, Greg wrote: > > I'm attempting to learn D through a personal project, and can't > > figure out how to get the message from an exception. > > I don't know why Throwable is not documented > (http://dlang.org/phobos/obje

Re: exception messages

2012-10-23 Thread Greg
Awesome, that's more informative than the API docs would have been anyway. BTW, another API docs problem I noticed is that on the main page, the module list in the sidebar doesn't match the module list in the page content (the sidebar has more modules, including std.exception). Thanks! On

Re: exception messages

2012-10-23 Thread Andrej Mitrovic
On 10/24/12, Greg wrote: > I'm attempting to learn D through a personal project, and can't > figure out how to get the message from an exception. I don't know why Throwable is not documented (http://dlang.org/phobos/object.html#Throwable), but you can use the .msg field: import std.exception; im

exception messages

2012-10-23 Thread Greg
I'm attempting to learn D through a personal project, and can't figure out how to get the message from an exception. I've basically defined a custom subclass of Exception to represent when invalid inputs are provided, and would like to have a master catch block that handles them, but I can't f

Re: Narrow string is not a random access range

2012-10-23 Thread Jonathan M Davis
On Wednesday, October 24, 2012 01:33:28 Timon Gehr wrote: > On 10/24/2012 01:07 AM, Jonathan M Davis wrote: > > On Wednesday, October 24, 2012 00:28:28 Timon Gehr wrote: > >> The other valid opinion is that the 'mistake' is in Phobos because it > >> treats narrow character arrays specially. > > >

Re: Narrow string is not a random access range

2012-10-23 Thread Adam D. Ruppe
On Tuesday, 23 October 2012 at 23:07:28 UTC, Jonathan M Davis wrote: I think that Andrei was arguing for changing how the compiler itself handles arrays of char and wchar so that they wouldn't As I said last time this came up, we could actually do this today without changing the compiler. Sinc

Re: Narrow string is not a random access range

2012-10-23 Thread Timon Gehr
On 10/24/2012 01:07 AM, Jonathan M Davis wrote: On Wednesday, October 24, 2012 00:28:28 Timon Gehr wrote: The other valid opinion is that the 'mistake' is in Phobos because it treats narrow character arrays specially. If it didn't, then range-based functions would be useless for strings in mos

Re: Narrow string is not a random access range

2012-10-23 Thread Jonathan M Davis
On Wednesday, October 24, 2012 00:28:28 Timon Gehr wrote: > The other valid opinion is that the 'mistake' is in Phobos because it > treats narrow character arrays specially. If it didn't, then range-based functions would be useless for strings in most cases, because it rarely makes sense to opera

Re: Narrow string is not a random access range

2012-10-23 Thread Timon Gehr
On 10/23/2012 05:58 PM, mist wrote: On Tuesday, 23 October 2012 at 15:55:23 UTC, Andrei Alexandrescu wrote: On 10/23/12 11:36 AM, mist wrote: Was thinking on this topic after seeing this: http://stackoverflow.com/questions/13014999/cannot-slice-taker-from-std-range-in-d Still can't understand

Re: overriding private interface methods

2012-10-23 Thread Jonathan M Davis
On Tuesday, October 23, 2012 11:47:09 Ali Çehreli wrote: > private member functions are not virtual by the design of the language. > You have to make them 'protected', not private. Yes, but according to TDPL, it's different for interfaces. It specifically talks about using private with interface

Re: More automated interfacing of D with C codebases

2012-10-23 Thread Brad Lanam
On Tuesday, 23 October 2012 at 19:10:29 UTC, Jacob Carlborg wrote: On 2012-10-23 19:42, Brad Lanam wrote: All of these don't use the same shell. Requiring to install bash would mean you do need to install special tools. Not really special but additional tools. But I would count Cygwin as a spe

Re: More automated interfacing of D with C codebases

2012-10-23 Thread Jacob Carlborg
On 2012-10-23 19:42, Brad Lanam wrote: I'm sorry, I don't see how that follows. My scripts work on All variants of Linux (2.4, 2.6), Solaris (2.6 - 11), AIX, Tru64, HP-UX, All *BSD, Mac OSX, Haiku, QNX, SCO, Syllable, UnixWare, Windows Cygwin. My 'di' program builds on all of the above with a

Re: overriding private interface methods

2012-10-23 Thread Ali Çehreli
On 10/23/2012 11:37 AM, Oleg wrote: Hello. How to override private methods? import std.stdio, std.conv; interface abcInterface { private double private_func(); public final double func() { return private_func(); } } class abcImpl: abcInterface { override private double private_func() { return

overriding private interface methods

2012-10-23 Thread Oleg
Hello. How to override private methods? import std.stdio, std.conv; interface abcInterface { private double private_func(); public final double func() { return private_func(); } } class abcImpl: abcInterface { override private double private_func() { return 3.14; } //#1 } void main

Threading Question

2012-10-23 Thread Peter Sommerfeld
Hi! I'm new to D an not a native speaker so I may misunderstand the following sentence of the thread documentation. "final @property void isDaemon(bool val); Sets the daemon status for this thread. While the runtime will wait for all normal threads to complete before tearing down the process, d

Re: More automated interfacing of D with C codebases

2012-10-23 Thread Brad Lanam
On Tuesday, 23 October 2012 at 06:35:06 UTC, Jacob Carlborg wrote: On 2012-10-22 21:48, Brad Lanam wrote: How can you mention bourne shell and portability in the same sentence? I doesn't work on Windows (yes I know about cygwin and mingw). Clang does work on Windows, I just haven't been able t

Re: Narrow string is not a random access range

2012-10-23 Thread Simen Kjaeraas
On 2012-10-23, 19:21, mist wrote: Hm, and all phobos functions should operate on narrow strings as if they where not random-acessible? I am thinking about something like commonPrefix from std.algorithm, which operates on code points for strings. Preferably, yes. If there are performance (

Re: Narrow string is not a random access range

2012-10-23 Thread mist
Hm, and all phobos functions should operate on narrow strings as if they where not random-acessible? I am thinking about something like commonPrefix from std.algorithm, which operates on code points for strings.

Re: Narrow string is not a random access range

2012-10-23 Thread Andrei Alexandrescu
On 10/23/12 12:35 PM, Andrei Alexandrescu wrote: On 10/23/12 11:58 AM, mist wrote: On Tuesday, 23 October 2012 at 15:55:23 UTC, Andrei Alexandrescu wrote: On 10/23/12 11:36 AM, mist wrote: Was thinking on this topic after seeing this: http://stackoverflow.com/questions/13014999/cannot-slice-ta

Re: Narrow string is not a random access range

2012-10-23 Thread Andrei Alexandrescu
On 10/23/12 11:58 AM, mist wrote: On Tuesday, 23 October 2012 at 15:55:23 UTC, Andrei Alexandrescu wrote: On 10/23/12 11:36 AM, mist wrote: Was thinking on this topic after seeing this: http://stackoverflow.com/questions/13014999/cannot-slice-taker-from-std-range-in-d Still can't understand r

Re: Narrow string is not a random access range

2012-10-23 Thread mist
On Tuesday, 23 October 2012 at 15:55:23 UTC, Andrei Alexandrescu wrote: On 10/23/12 11:36 AM, mist wrote: Was thinking on this topic after seeing this: http://stackoverflow.com/questions/13014999/cannot-slice-taker-from-std-range-in-d Still can't understand rationale here. Why native slicing /

Re: Narrow string is not a random access range

2012-10-23 Thread Andrei Alexandrescu
On 10/23/12 11:36 AM, mist wrote: Was thinking on this topic after seeing this: http://stackoverflow.com/questions/13014999/cannot-slice-taker-from-std-range-in-d Still can't understand rationale here. Why native slicing / random access is allowed for narrow strings, but trait explicitly negates

Narrow string is not a random access range

2012-10-23 Thread mist
Was thinking on this topic after seeing this: http://stackoverflow.com/questions/13014999/cannot-slice-taker-from-std-range-in-d Still can't understand rationale here. Why native slicing / random access is allowed for narrow strings, but trait explicitly negates this?

msgpack unresolved question

2012-10-23 Thread Dan
I got msgpack and was trying out an example (compare_json.d) and I get an unresolved error. Not sure what I'm doing wrong... https://github.com/msgpack/msgpack-d/blob/master/src/msgpack.d I think length is built in for associative arrays? Thanks Dan The error and lines of code is: - /tmp/

Re: How to start new command with arguments, pass data to its stdin read its output?

2012-10-23 Thread Regan Heath
On Tue, 23 Oct 2012 13:29:59 +0100, denizzzka <4deni...@gmail.com> wrote: On Tuesday, 23 October 2012 at 12:19:08 UTC, Adam D. Ruppe wrote: On Tuesday, 23 October 2012 at 11:34:35 UTC, denizzzka wrote: Something like execv() but with stdin/stdout? If you're on linux i have a little file that

Re: How to start new command with arguments, pass data to its stdin read its output?

2012-10-23 Thread denizzzka
On Tuesday, 23 October 2012 at 12:19:08 UTC, Adam D. Ruppe wrote: On Tuesday, 23 October 2012 at 11:34:35 UTC, denizzzka wrote: Something like execv() but with stdin/stdout? If you're on linux i have a little file that might help: http://arsdnet.net/dcode/exec.d int exec( string program,

Re: How to start new command with arguments, pass data to its stdin read its output?

2012-10-23 Thread Adam D. Ruppe
On Tuesday, 23 October 2012 at 11:34:35 UTC, denizzzka wrote: Something like execv() but with stdin/stdout? If you're on linux i have a little file that might help: http://arsdnet.net/dcode/exec.d int exec( string program, string[] args = null, string input = null, string* output

Re: How to start new command with arguments, pass data to its stdin read its output?

2012-10-23 Thread denizzzka
On Tuesday, 23 October 2012 at 11:34:35 UTC, denizzzka wrote: Something like execv() but with stdin/stdout? Something like popen(), not execv().

How to start new command with arguments, pass data to its stdin read its output?

2012-10-23 Thread denizzzka
Something like execv() but with stdin/stdout?