How about a handy way of wrapping all function parameters?

2011-04-05 Thread Andrej Mitrovic
E.g. this code: class Foo { int wndProc(uint msg, int wParam, int lParam) { return 0; } } class Bar : Foo { override int wndProc(uint msg, int wParam, int lParam) { switch(msg) { case 1: return 1; default:

Re: incompatible types!

2011-04-05 Thread Jonathan M Davis
> On Tue, 05 Apr 2011 19:37:15 -0400, Caligo wrote: > > It's just frustrating, that's all. Writing thousands of lines of code > > and having everything stop because of a compiler bug is just > > frustrating. > > I completely understand. It's why I have to periodically stop using D. > Dcollectio

Re: incompatible types!

2011-04-05 Thread Steven Schveighoffer
On Tue, 05 Apr 2011 19:37:15 -0400, Caligo wrote: It's just frustrating, that's all. Writing thousands of lines of code and having everything stop because of a compiler bug is just frustrating. I completely understand. It's why I have to periodically stop using D. Dcollections sat idle f

Re: incompatible types!

2011-04-05 Thread Caligo
It's just frustrating, that's all. Writing thousands of lines of code and having everything stop because of a compiler bug is just frustrating. I know progress is being made, and all that is appreciated. But, I don't remember ever hearing anything about D2 being in beta. If anything, I remember

Re: time_t to simple date string conversion

2011-04-05 Thread Jonathan M Davis
> On Tue, 05 Apr 2011 18:20:02 -0400, Jonathan M Davis > > wrote: > > toSimpleString (which toString calls) does give the short version of the > > month > > in it, but during the review process, a number of the folks reviewing > > it were > > against putting code in there relating to printing the

Re: time_t to simple date string conversion

2011-04-05 Thread Steven Schveighoffer
On Tue, 05 Apr 2011 18:20:02 -0400, Jonathan M Davis wrote: toSimpleString (which toString calls) does give the short version of the month in it, but during the review process, a number of the folks reviewing it were against putting code in there relating to printing the month out as a

Re: time_t to simple date string conversion

2011-04-05 Thread Jonathan M Davis
> On 04/05/2011 03:59 PM, Jonathan M Davis wrote: > >> I'm reading documentation on std.datetime, and it appears there are > >> added features that I don't have in 2.51 (Linux). Did features like > >> 'SysTime' get added after 2.51? > >> > >> Does anybody have a one-liner to convert a time_t to a

Re: time_t to simple date string conversion

2011-04-05 Thread Kai Meyer
On 04/05/2011 03:40 PM, Steven Schveighoffer wrote: On Tue, 05 Apr 2011 17:24:11 -0400, Kai Meyer wrote: I'm reading documentation on std.datetime, and it appears there are added features that I don't have in 2.51 (Linux). Did features like 'SysTime' get added after 2.51? Does anybody have a

Re: time_t to simple date string conversion

2011-04-05 Thread Jonathan M Davis
> On Tue, 05 Apr 2011 17:24:11 -0400, Kai Meyer wrote: > > I'm reading documentation on std.datetime, and it appears there are > > added features that I don't have in 2.51 (Linux). Did features like > > 'SysTime' get added after 2.51? > > > > Does anybody have a one-liner to convert a time_t to a

Re: time_t to simple date string conversion

2011-04-05 Thread Kai Meyer
On 04/05/2011 03:59 PM, Jonathan M Davis wrote: I'm reading documentation on std.datetime, and it appears there are added features that I don't have in 2.51 (Linux). Did features like 'SysTime' get added after 2.51? Does anybody have a one-liner to convert a time_t to a date string that should w

Re: time_t to simple date string conversion

2011-04-05 Thread Jonathan M Davis
> I'm reading documentation on std.datetime, and it appears there are > added features that I don't have in 2.51 (Linux). Did features like > 'SysTime' get added after 2.51? > > Does anybody have a one-liner to convert a time_t to a date string that > should work for me? std.datetime was complete

Re: time_t to simple date string conversion

2011-04-05 Thread Steven Schveighoffer
On Tue, 05 Apr 2011 17:40:12 -0400, Steven Schveighoffer wrote: On Tue, 05 Apr 2011 17:24:11 -0400, Kai Meyer wrote: I'm reading documentation on std.datetime, and it appears there are added features that I don't have in 2.51 (Linux). Did features like 'SysTime' get added after 2.51?

Re: time_t to simple date string conversion

2011-04-05 Thread Steven Schveighoffer
On Tue, 05 Apr 2011 17:24:11 -0400, Kai Meyer wrote: I'm reading documentation on std.datetime, and it appears there are added features that I don't have in 2.51 (Linux). Did features like 'SysTime' get added after 2.51? Does anybody have a one-liner to convert a time_t to a date string th

time_t to simple date string conversion

2011-04-05 Thread Kai Meyer
I'm reading documentation on std.datetime, and it appears there are added features that I don't have in 2.51 (Linux). Did features like 'SysTime' get added after 2.51? Does anybody have a one-liner to convert a time_t to a date string that should work for me? -Kai Meyer

Re: incompatible types!

2011-04-05 Thread Steven Schveighoffer
On Tue, 05 Apr 2011 15:48:36 -0400, Caligo wrote: I searched the bugzilla and there are 'alias this' related bugs. Some of them are 2 years old and have not been fixed. There are many bugs in that category. inout I think is a prime example. I don't really know what to say to appease your e

Re: assumeSafeAppend inconsistent when multiple slices in use

2011-04-05 Thread Steven Schveighoffer
On Tue, 05 Apr 2011 15:24:46 -0400, simendsjo wrote: I don't know if this is an actual problem, but I don't understand the behavior. When one slice calls assumeSafeAppend, both slices is "given control", that is, gets the parents capacity. You have to stop thinking of array slices as unique :

Re: incompatible types!

2011-04-05 Thread Caligo
I searched the bugzilla and there are 'alias this' related bugs. Some of them are 2 years old and have not been fixed. I've heard bugs get fixed rather quickly if something is posted on reddit about them.

assumeSafeAppend inconsistent when multiple slices in use

2011-04-05 Thread simendsjo
I don't know if this is an actual problem, but I don't understand the behavior. When one slice calls assumeSafeAppend, both slices is "given control", that is, gets the parents capacity. It's best explained with an example: int[] a; a.length = 4; int[] b = a[0..1];

Re: incompatible types!

2011-04-05 Thread Philippe Sigaud
What's strange is that auto r3 = r1 + r2; works. Bug indeed...

Re: ElementType!(Range) problem

2011-04-05 Thread Philippe Sigaud
> > I get a "untitled.d(32): Error: template instance ElementType!(listR) does not > match template declaration ElementType(R)" error. > > What could be the problem ? > -- > > import std.stdio; > import std.range; > import std.

Re: Is there an equivalent to toStringz for wide strings?

2011-04-05 Thread Andrej Mitrovic
On 4/5/11, Kagamin wrote: > toUTF16z > it was in windows examples somewhere, I suppose. > Great, it's in std.utf. Thanks!

Re: incompatible types!

2011-04-05 Thread Steven Schveighoffer
On Tue, 05 Apr 2011 14:08:42 -0400, Caligo wrote: On Tue, Apr 5, 2011 at 12:32 PM, Steven Schveighoffer wrote: On Tue, 05 Apr 2011 13:23:04 -0400, Caligo wrote: Why does the last expression fail? and how do I fix it? Because alias this is not very well implemented yet (I've run into

Re: The is expression

2011-04-05 Thread Philippe Sigaud
> thanks for your answer. If it is that complicated if I prefer explicit > specialization, I think. But I do not quite understand that it is not > possible to achieve this with a simple "is" expression (without a > function like "isAnA" and using "__traits") as the D language reference > includes a

Re: incompatible types!

2011-04-05 Thread Caligo
On Tue, Apr 5, 2011 at 12:32 PM, Steven Schveighoffer wrote: > On Tue, 05 Apr 2011 13:23:04 -0400, Caligo wrote: > >> Why does the last expression fail? and how do I fix it? > > Because alias this is not very well implemented yet (I've run into similar > issues), and you fix it by creating a bug

ElementType!(Range) problem

2011-04-05 Thread Ishan Thilina
I can use the ElementType() template in the std.rane library to find the type of the elements of a range,isn't it? But I cant compile the following programme. I get a "untitled.d(32): Error: template instance ElementType!(listR) does not match template declaration ElementType(R)" error. What coul

Re: null Vs [] return arrays

2011-04-05 Thread Steven Schveighoffer
On Tue, 05 Apr 2011 13:24:49 -0400, Regan Heath wrote: On Fri, 01 Apr 2011 18:23:28 +0100, Steven Schveighoffer wrote: assert("" !is null); // works on D. Try it. Yes, but that's because this is a string literal. It's not useful where you're getting your input from somewhere else..

Re: incompatible types!

2011-04-05 Thread Steven Schveighoffer
On Tue, 05 Apr 2011 13:23:04 -0400, Caligo wrote: Why does the last expression fail? and how do I fix it? Because alias this is not very well implemented yet (I've run into similar issues), and you fix it by creating a bug report or voting for an already existing one. Sorry. -Steve

Re: null Vs [] return arrays

2011-04-05 Thread Regan Heath
On Fri, 01 Apr 2011 18:23:28 +0100, Steven Schveighoffer wrote: On Fri, 01 Apr 2011 11:52:47 -0400, Regan Heath wrote: But, in D it seems I cannot do this. In D I would have to pass an additional boolean parameter, or add another level of indirection i.e. pass a string[]*. The same prob

incompatible types!

2011-04-05 Thread Caligo
import std.conv : to; struct Matrix(T, size_t r, size_t c){ public: T[r*c] _data; Matrix opBinary(string op)(T scalar) if(op == "*"){ string construct(){ string result = "["; for(size_t i = 0; i < r * c; i++) result ~= "_data["~to!string(i)~"] * scalar, "; retur

Re: Is there an equivalent to toStringz for wide strings?

2011-04-05 Thread Kagamin
Andrej Mitrovic Wrote: > I think I'd need a toWStringz function, or maybe toStringz can be made more > clever and figure out that I'm passing a wstring and return a null-terminated > wchar*. > > Currently I'm using wstrings and appending the null terminator by hand, e.g.: > > wstring appName

Re: The is expression

2011-04-05 Thread enuhtac
Am 03.04.2011 16:11, schrieb Philippe Sigaud: > On Sat, Apr 2, 2011 at 13:05, enuhtac wrote: >> This is the type I would like to check for: >> >> struct A( T, string s ) >> { ... }; > Hi, > > the trick is to use a function do the work for you. Let's define isAnA: > > void isAnA(T, string s)( A!(T,

Re: Using opDispatch as *magic* getter/setter. Possible or not?

2011-04-05 Thread Aleksandar Ružičić
On Tue, Apr 5, 2011 at 6:46 AM, Simen kjaeraas wrote: > Bug 620[1] is related to what you ask. I have written a solution there, > but I do not remember how well it works, and have no way of testing it > currently: > > template opDispatch( string name ) { >    auto opDispatch( T... )( T args ) { >