Re: override toString() for a tuple?

2014-06-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Wed, 04 Jun 2014 05:35:18 + Steve D via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Is it possible to override std tuple's toString format? so that auto a = tuple(hello,1,2,3); writeln(a); prints (hello, 1, 2, 3) and not

Re: override toString() for a tuple?

2014-06-04 Thread Steve D via Digitalmars-d-learn
On Wednesday, 4 June 2014 at 06:04:22 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: toString is a member of Tuple, and there's no way to override that externally. ... Hi Jonathan, Yeah, I'll probably just keep my locally cobbled version of typecons.d in my path. The other options

Re: why it said no identifier for declarator …

2014-06-04 Thread bioinfornatics via Digitalmars-d-learn
On Wednesday, 4 June 2014 at 00:07:35 UTC, Jesse Phillips wrote: On Tuesday, 3 June 2014 at 22:10:06 UTC, bioinfornatics wrote: I do not see why it fail in debug output we see that tuple have a field with given name. Your generated output (short and formatted) alias TL = Tuple!(int,x,

Re: override toString() for a tuple?

2014-06-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Wed, 04 Jun 2014 06:25:53 + Steve D via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: You would think the promise of OO and Inheritance would make it easy and free us from hacks like this ;) That would require using OO and inheritance, which has nothing to do with Tuple.

Re: why it said no identifier for declarator …

2014-06-04 Thread bioinfornatics via Digitalmars-d-learn
On Wednesday, 4 June 2014 at 00:07:35 UTC, Jesse Phillips wrote: On Tuesday, 3 June 2014 at 22:10:06 UTC, bioinfornatics wrote: I do not see why it fail in debug output we see that tuple have a field with given name. Your generated output (short and formatted) alias TL = Tuple!(int,x,

Re: Building 32bit program with MSVC?

2014-06-04 Thread Kagamin via Digitalmars-d-learn
LLVM never supported OMF. LDC uses msvcrt runtime, and MS claims that whatever can link with msvcrt, it also can link with later versions of msvcrt.

Re: Kernel in D

2014-06-04 Thread Kagamin via Digitalmars-d-learn
On Saturday, 31 May 2014 at 23:27:45 UTC, Qox wrote: On Saturday, 31 May 2014 at 07:57:18 UTC, Kagamin wrote: http://www.xomb.org/ ? seems to be outdated, but its another OS written in D. It's dead for only a year, the developer have probably graduated.

Re: why it said no identifier for declarator …

2014-06-04 Thread Jesse Phillips via Digitalmars-d-learn
I take it the output looks something like this: struct S { int a; } S s; s.a = 3; void main() { } Hope this clears up this next problem. Module scope doesn't get to utilize a variable, it can only initialize at compile-time.

Arrays as template parameters

2014-06-04 Thread cal via Digitalmars-d-learn
I have the following code (on dpaste, http://dpaste.dzfl.pl/636c04430a33): enum : uint { a, b, c } enum list = [a, b]; void foo(T...)() { pragma(msg, T[0].length); // fine pragma(msg, T[0][0]); // fine pragma(msg, T[0][1]); // fine foreach(i; Iota!(0,T[0].length)) //

how to get line number after readln

2014-06-04 Thread Robert Hathaway via Digitalmars-d-learn
I've got a program that reads a text file line by line (using std.stdio readln()) and I'd like to refer to the line number when I send a message to stderr upon finding a mis-formatted line. Is there a way to get the current line number? Of course, I could create a counter and increment it

Re: how to get line number after readln

2014-06-04 Thread Ali Çehreli via Digitalmars-d-learn
On 06/04/2014 05:05 PM, Robert Hathaway wrote: I've got a program that reads a text file line by line (using std.stdio readln()) Consider using byLine() instead. (Important: byLine uses an internal buffer for the line; so, don't forget to make a copy if you want to store the line for later

Re: how to get line number after readln

2014-06-04 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 5 June 2014 at 00:33:26 UTC, Ali Çehreli wrote: On 06/04/2014 05:05 PM, Robert Hathaway wrote: I've got a program that reads a text file line by line (using std.stdio readln()) Consider using byLine() instead. (Important: byLine uses an internal buffer for the line; so, don't