Re: DDoc with cross-references

2012-04-01 Thread Jacob Carlborg
On 2012-04-02 07:52, Ary Manzana wrote: On 4/2/12 12:39 PM, Jonathan M Davis wrote: Phobos' macros are in https://github.com/D-Programming-Language/d-programming- language.org/blob/master/std.ddoc As for linking macros, LREF is used for references within a module. XREF is used for references

Re: DDoc with cross-references

2012-04-01 Thread Jacob Carlborg
On 2012-04-02 06:20, Ary Manzana wrote: I'm planning to add cross-references to the default ddoc output. At least that's the simplest thing I could do right now that might improve ddoc somehow. That would be so nice to have. -- /Jacob Carlborg

Re: Getting only the data members of a type

2012-04-01 Thread Jacob Carlborg
On 2012-04-02 02:43, Ary Manzana wrote: This is what I don't like about D. It gives you a hammer and everyone tries to solve all problems with that single hammer. Then you get duplicated code for basic stuff, like getting the type of a field, in many projects. It's a waste of time for a develop

Re: DDoc with cross-references

2012-04-01 Thread Ary Manzana
On 4/2/12 2:16 PM, Ary Manzana wrote: On 4/2/12 2:07 PM, Jonathan M Davis wrote: On Monday, April 02, 2012 13:52:47 Ary Manzana wrote: On 4/2/12 12:39 PM, Jonathan M Davis wrote: On Monday, April 02, 2012 12:20:31 Ary Manzana wrote: I'm planning to add cross-references to the default ddoc out

Re: "ref const" parameters in functions

2012-04-01 Thread L-MAN
On Monday, 2 April 2012 at 05:03:48 UTC, Jonathan M Davis wrote: On Sunday, April 01, 2012 21:23:50 Jonathan M Davis wrote: On Monday, April 02, 2012 05:46:24 L-MAN wrote: Sure, if you have large structs, making a lot of copies of them can be expensive. But to avoid that, you're going to have t

Re: Add Element to list not Working

2012-04-01 Thread Chris Pons
Thanks. I tried doing this and the list didn't update: void AddToList( SList!int list, int i ) { list.insert( i ); } SList!int intList; AddToList( intList, 42 ); but when I switched to this, it worked: SList!int intList; void AddToList( int i ) { intList.insert( i ); } AddToList( 42

Re: DDoc with cross-references

2012-04-01 Thread Ary Manzana
On 4/2/12 2:07 PM, Jonathan M Davis wrote: On Monday, April 02, 2012 13:52:47 Ary Manzana wrote: On 4/2/12 12:39 PM, Jonathan M Davis wrote: On Monday, April 02, 2012 12:20:31 Ary Manzana wrote: I'm planning to add cross-references to the default ddoc output. At least that's the simplest thing

Re: Add Element to list not Working

2012-04-01 Thread James Miller
On 2 April 2012 17:45, Chris Pons wrote: > I'm trying to add an element to a list with insert but that doesn't seem to > do anything at all. If I try using ~= it says that "Error: cannot append > type Node to type SList!(Node). I'm pretty confused about using ~= because > it works fine for arrays

Re: Add Element to list not Working

2012-04-01 Thread Ali Çehreli
On 04/01/2012 10:45 PM, Chris Pons wrote: I'm trying to add an element to a list with insert but that doesn't seem to do anything at all. If I try using ~= it says that "Error: cannot append type Node to type SList!(Node). I'm pretty confused about using ~= because it works fine for arrays but ap

Re: DDoc with cross-references

2012-04-01 Thread Jonathan M Davis
On Monday, April 02, 2012 13:52:47 Ary Manzana wrote: > On 4/2/12 12:39 PM, Jonathan M Davis wrote: > > On Monday, April 02, 2012 12:20:31 Ary Manzana wrote: > >> I'm planning to add cross-references to the default ddoc output. At > >> least that's the simplest thing I could do right now that might

Re: DDoc with cross-references

2012-04-01 Thread Ary Manzana
On 4/2/12 12:39 PM, Jonathan M Davis wrote: On Monday, April 02, 2012 12:20:31 Ary Manzana wrote: I'm planning to add cross-references to the default ddoc output. At least that's the simplest thing I could do right now that might improve ddoc somehow. I see the documentation generated for phobo

Add Element to list not Working

2012-04-01 Thread Chris Pons
I'm trying to add an element to a list with insert but that doesn't seem to do anything at all. If I try using ~= it says that "Error: cannot append type Node to type SList!(Node). I'm pretty confused about using ~= because it works fine for arrays but apperantly not for lists. How do I add a

Re: std.typecons.Ref(T).opImplicitCastTo()

2012-04-01 Thread Jonathan M Davis
On Monday, April 02, 2012 07:23:23 Alex Rønne Petersen wrote: > On 02-04-2012 06:25, Jonathan M Davis wrote: > > alias this is not supposed to be restricted such that you can only have > > one > > per type. That's a temporary, implementation problem. TDPL specifically > > talks about having multipl

Re: std.typecons.Ref(T).opImplicitCastTo()

2012-04-01 Thread Alex Rønne Petersen
On 02-04-2012 06:25, Jonathan M Davis wrote: On Monday, April 02, 2012 05:41:00 Alex Rønne Petersen wrote: On 30-03-2012 19:28, Jonathan M Davis wrote: On Friday, March 30, 2012 16:27:44 simendsjo wrote: Is opImplicitCastTo a planned feature? It's only used in this type as I can see, and it do

Re: "ref const" parameters in functions

2012-04-01 Thread Jonathan M Davis
On Sunday, April 01, 2012 21:23:50 Jonathan M Davis wrote: > On Monday, April 02, 2012 05:46:24 L-MAN wrote: > Sure, if you have large structs, making a lot of copies of them can be > expensive. But to avoid that, you're going to have to avoid coding in a way > which creates temporaries, and expres

Re: DDoc with cross-references

2012-04-01 Thread Jonathan M Davis
On Monday, April 02, 2012 12:20:31 Ary Manzana wrote: > I'm planning to add cross-references to the default ddoc output. At > least that's the simplest thing I could do right now that might improve > ddoc somehow. > > I see the documentation generated for phobos, for example: > > http://dlang.org

Re: std.typecons.Ref(T).opImplicitCastTo()

2012-04-01 Thread Jonathan M Davis
On Monday, April 02, 2012 15:36:01 James Miller wrote: > On 31 March 2012 06:28, Jonathan M Davis wrote: > > it also has > > opDot, which is being removed from the language. > > Out of curiosity, what was opDot? An overload of the dot operator. So, if you had A a = foo(); a.func(); and A imple

Re: DDoc with cross-references

2012-04-01 Thread Ary Manzana
On 4/2/12 12:20 PM, Ary Manzana wrote: I'm planning to add cross-references to the default ddoc output. At least that's the simplest thing I could do right now that might improve ddoc somehow. I see the documentation generated for phobos, for example: http://dlang.org/phobos/std_array.html#Appe

Re: std.typecons.Ref(T).opImplicitCastTo()

2012-04-01 Thread Jonathan M Davis
On Monday, April 02, 2012 05:41:00 Alex Rønne Petersen wrote: > On 30-03-2012 19:28, Jonathan M Davis wrote: > > On Friday, March 30, 2012 16:27:44 simendsjo wrote: > >> Is opImplicitCastTo a planned feature? > >> It's only used in this type as I can see, and it doesn't add implicit > >> casting. >

DDoc with cross-references

2012-04-01 Thread Ary Manzana
I'm planning to add cross-references to the default ddoc output. At least that's the simplest thing I could do right now that might improve ddoc somehow. I see the documentation generated for phobos, for example: http://dlang.org/phobos/std_array.html#Appender has anchors to the many symbols

Re: "ref const" parameters in functions

2012-04-01 Thread Jonathan M Davis
On Monday, April 02, 2012 05:46:24 L-MAN wrote: > About temporaries in operators +-/*.. you're right, it is not a > secret. > references in other functions (not in operators) too. > > > I can't understand one thing: > ABC abc; // ABC is a struct that consists of some 4x4 matrix for > example >

Re: "ref const" parameters in functions

2012-04-01 Thread L-MAN
On Sunday, 1 April 2012 at 08:22:08 UTC, Jonathan M Davis wrote: On Sunday, April 01, 2012 09:10:58 L-MAN wrote: On Saturday, 31 March 2012 at 21:42:05 UTC, Jonathan M Davis wrote: > On Saturday, March 31, 2012 23:25:51 L-MAN wrote: >> Hello everybody! >> >> I'm trying to use some function FN

Re: std.typecons.Ref(T).opImplicitCastTo()

2012-04-01 Thread Alex Rønne Petersen
On 30-03-2012 19:28, Jonathan M Davis wrote: On Friday, March 30, 2012 16:27:44 simendsjo wrote: Is opImplicitCastTo a planned feature? It's only used in this type as I can see, and it doesn't add implicit casting. It's been discussed, but I don't think that it's ever been agreed upon. In theo

Re: std.typecons.Ref(T).opImplicitCastTo()

2012-04-01 Thread James Miller
On 31 March 2012 06:28, Jonathan M Davis wrote: > it also has > opDot, which is being removed from the language. Out of curiosity, what was opDot? -- James Miller

Re: Getting only the data members of a type

2012-04-01 Thread Ary Manzana
On 4/1/12 8:09 PM, Jacob Carlborg wrote: On 2012-04-01 08:18, Ali Çehreli wrote: On 03/31/2012 09:09 PM, Artur Skawina wrote: > > enum s = cast(S*)null; > foreach (i, m; s.tupleof) { > enum name = S.tupleof[i].stringof[4..$]; > alias typeof(m) type; > writef("(%s) %s\n", type.stringof, name);

Re: UFCS for types?

2012-04-01 Thread James Miller
On 31 March 2012 21:37, simendsjo wrote: > Is is possible to use UFCS for types to simulate static members? > > struct S { >    static void f(); > } > > void ext(S)() { >    S.f(); > } > > void main() { >    ext!S(); // ok >    S.ext(); // Error: no property 'ext' for type 'S' > } As far as I kno

Re: std.json dynamic initialization of JSONValue

2012-04-01 Thread Piotr Szturmaj
Nicolas Silva wrote: On Sat, Mar 31, 2012 at 12:25 PM, Piotr Szturmaj wrote: I have written streaming json parser using ranges. It returns slices when possible. Benchmarked it and it's about 2.05x the speed of std.json. It gives possibility to "dig" into the structure and stream (using ranges)

Re: Whats the best way to get a struct/class member type?

2012-04-01 Thread Simen Kjærås
On Sat, 31 Mar 2012 15:20:42 +0200, simendsjo wrote: Seems __traits doesn't have a __traits(getMemberType, T, name). Now I'm doing the following: T t; // instance to use in getMember alias typeof( __traits(getMember, t, name) ) MemberType; Is this the only way to get the type of a field based

Re: Where does "U" in Rebindable.Rebindable come from?

2012-04-01 Thread Simen Kjærås
On Fri, 30 Mar 2012 19:52:50 +0200, simendsjo wrote: On Fri, 30 Mar 2012 17:13:25 +0200, Simen Kjærås wrote: Indeed. The thing is - U is basically *set* by the isExpression. It says 'yes, there is such a U, so I'll add it to the local scope.'. This means that U will be set for the entire sc

Re: Nested interface

2012-04-01 Thread Read Bixby
Thanks; entered as issue 7807. On Sunday, 1 April 2012 at 20:17:09 UTC, Timon Gehr wrote: On 04/01/2012 08:13 PM, Read Bixby wrote: Hm, I guess it's much simpler than that. I must not be understanding something about covariance. The following code produces the same error message (it has noth

Re: Nested interface

2012-04-01 Thread Timon Gehr
On 04/01/2012 08:13 PM, Read Bixby wrote: Hm, I guess it's much simpler than that. I must not be understanding something about covariance. The following code produces the same error message (it has nothing to do with nestedness or shared classes): interface Interface { Interface getNext(

Re: Read a unicode character from the terminal

2012-04-01 Thread Jacob Carlborg
On 2012-04-01 16:02, Ali Çehreli wrote: No difference in that example because it consumes the entire input as dchars. But in general, with that inefficient range, it is possible to pull just one dchar from the input and leave the rest of the stream untouched. For example, it would be possible t

Re: Nested interface

2012-04-01 Thread Read Bixby
Hm, I guess it's much simpler than that. I must not be understanding something about covariance. The following code produces the same error message (it has nothing to do with nestedness or shared classes): interface Interface { Interface getNext(); const(Interface) getNext()

Nested interface

2012-04-01 Thread Read Bixby
I was working on a small personal project, and ran across something I think might (or might not) be a bug. I'm posting in this particular group just in case it's a restriction somewhere that I just don't know about, or maybe just the way that covariance gets resolved. The obvious workaround i

Re: Simulating multiple inheritance

2012-04-01 Thread bls
On 03/31/2012 10:05 AM, Andrej Mitrovic wrote: One issue with the new wxWidgets 2.9.x series is that there seem to be more multiply-inherited classes than before A bit more complete snippet. interface Foo { void doFoo(); } // Foo implementation mixin template FooMixin() { alias typeof(

Re: Read a unicode character from the terminal

2012-04-01 Thread Ali Çehreli
On 04/01/2012 05:00 AM, Jacob Carlborg wrote: On 2012-04-01 01:17, Ali Çehreli wrote: On 03/31/2012 11:53 AM, Ali Çehreli wrote: > The solution is to use ranges when pulling Unicode characters out of > strings. std.stdin does not provide this yet, but it will eventually > happen (so I've heard

Re: std.json dynamic initialization of JSONValue

2012-04-01 Thread Nicolas Silva
On Sat, Mar 31, 2012 at 12:25 PM, Piotr Szturmaj wrote: > Andrej Mitrovic wrote: >> >> On 12/1/11, Kai Meyer  wrote: >>> >>> I'm finding std.json extremely well written, with one glaring exception. >> >> >> I'm finding it to be crap. The last time I used it I just kept getting >> access violations

Re: Getting only the data members of a type

2012-04-01 Thread Artur Skawina
On 04/01/12 14:10, Jacob Carlborg wrote: > On 2012-04-01 11:27, Artur Skawina wrote: > >> That's because the compiler won't accept "foreach (i, t; S.tupleof)" and > > But it accepts "foreach (i, t; typeof(S.tupleof))". It does - thank you. This means that that ugly null-to-pointer cast from my

Re: Simulating multiple inheritance

2012-04-01 Thread bls
On 03/31/2012 10:05 AM, Andrej Mitrovic wrote: This is related to wrapping wxWidgets. One issue with the new wxWidgets 2.9.x series is that there seem to be more multiply-inherited classes than before As Jacob already said mixin templates and Interfaces are the way to go. I think you have to d

Re: Getting only the data members of a type

2012-04-01 Thread Jacob Carlborg
On 2012-04-01 11:27, Artur Skawina wrote: That's because the compiler won't accept "foreach (i, t; S.tupleof)" and "*.tupleof[i].stringof" is necessary to get the original name. This would have worked too: enum name = *s.tupleof[i].stringof[4..$]; but obfuscates the code more and looks

Re: Getting only the data members of a type

2012-04-01 Thread Jacob Carlborg
On 2012-04-01 08:18, Ali Çehreli wrote: On 03/31/2012 09:09 PM, Artur Skawina wrote: > > enum s = cast(S*)null; > foreach (i, m; s.tupleof) { > enum name = S.tupleof[i].stringof[4..$]; > alias typeof(m) type; > writef("(%s) %s\n", type.stringof, name); > } > > Real Programmers don't u

Re: Read a unicode character from the terminal

2012-04-01 Thread Jacob Carlborg
On 2012-04-01 00:14, Stewart Gordon wrote: On 31/03/2012 16:56, Jacob Carlborg wrote: How would I read a unicode character from the terminal? I've tried using "std.cstream.din.getc" but it seems to only work for ascii characters. If I try to read and print something that isn't ascii, it just pri

Re: Read a unicode character from the terminal

2012-04-01 Thread Jacob Carlborg
On 2012-04-01 01:17, Ali Çehreli wrote: On 03/31/2012 11:53 AM, Ali Çehreli wrote: > The solution is to use ranges when pulling Unicode characters out of > strings. std.stdin does not provide this yet, but it will eventually > happen (so I've heard :)). Here is a Unicode character range, whi

Re: Read a unicode character from the terminal

2012-04-01 Thread Jacob Carlborg
On 2012-03-31 20:53, Ali Çehreli wrote: I recommend using stdin. The destiny of std.cstream is uncertain and stdin is sufficient. (I know that it lacks support for BOM but I don't need them.) I thought std.cstream was a stream wrapper around stdin. The word 'character' used to mean characters

Re: Simulating multiple inheritance

2012-04-01 Thread Jacob Carlborg
On 2012-03-31 19:05, Andrej Mitrovic wrote: This is related to wrapping wxWidgets. One issue with the new wxWidgets 2.9.x series is that there seem to be more multiply-inherited classes than before. In particular some of the main classes have become MI classes (e.g. wxApp derives from wxAppConso

Re: Problem with receiveOnly and classes

2012-04-01 Thread Ghislain
> Either way, I once tried to pass over "ownership" of trees of objects to > other threads but gave up on that. I don't think std.concurrency and D > really can work like that. (?) Concurrency seems to work much better > when you pass messages and data, structs are fine, and then build object > tre

Re: Getting only the data members of a type

2012-04-01 Thread Artur Skawina
On 04/01/12 11:27, Artur Skawina wrote: > On 04/01/12 08:18, Ali Çehreli wrote: >> On 03/31/2012 09:09 PM, Artur Skawina wrote: >>> This will print all fields of struct/class S: >>> >>> enum s = cast(S*)null; >>> foreach (i, m; s.tupleof) { >>>enum name = S.tupleof[i].stringof[4..$]

Re: Getting only the data members of a type

2012-04-01 Thread Artur Skawina
On 04/01/12 08:18, Ali Çehreli wrote: > On 03/31/2012 09:09 PM, Artur Skawina wrote: >> On 03/31/12 21:09, Ali Çehreli wrote: >>> How can I determine just the data members of a struct or class, excluding >>> the member functions? isCallable() comes short as member variable that have >>> opCall()

Re: "ref const" parameters in functions

2012-04-01 Thread Jonathan M Davis
On Sunday, April 01, 2012 09:10:58 L-MAN wrote: > On Saturday, 31 March 2012 at 21:42:05 UTC, Jonathan M Davis > > wrote: > > On Saturday, March 31, 2012 23:25:51 L-MAN wrote: > >> Hello everybody! > >> > >> I'm trying to use some function FN like this: > >> > >> struct X > >> { > >> > >> pro

Re: "ref const" parameters in functions

2012-04-01 Thread L-MAN
On Saturday, 31 March 2012 at 21:42:05 UTC, Jonathan M Davis wrote: On Saturday, March 31, 2012 23:25:51 L-MAN wrote: Hello everybody! I'm trying to use some function FN like this: struct X { protected double _x; // double type for example public @property double X() const { return _x; }