Re: array of elements of various sybtypes

2011-01-26 Thread Andrej Mitrovic
On 1/27/11, Steven Schveighoffer wrote: > I'm not sure why this works and the other doesn't, but we > definitely need something that allows one to control the array type of a > literal. pragma helps in discovering what DMD does sometime. This will error out but it will give some useful info: pr

Re: array of elements of various sybtypes

2011-01-26 Thread Steven Schveighoffer
On Wed, 26 Jan 2011 22:10:58 -0500, Jonathan M Davis wrote: On Wednesday 26 January 2011 18:59:50 Steven Schveighoffer wrote: On Wed, 26 Jan 2011 18:28:12 -0500, Jonathan M Davis wrote: > I believe that it's supposed to take the common type of t1 and t2 and > make the > result an array o

Re: concatenation

2011-01-26 Thread Ellery Newcomer
On 01/24/2011 05:22 PM, Robert Clipsham wrote: On 24/01/11 23:09, Ellery Newcomer wrote: in the following: void main(){ char[] x; string s; string y; y = s ~ x; } tok.d(5): Error: cannot implicitly convert expression (cast(const(char)[])s ~ x) of type char[] to string why should typeof(s ~ x

Re: array of elements of various sybtypes

2011-01-26 Thread Jonathan M Davis
On Wednesday 26 January 2011 18:59:50 Steven Schveighoffer wrote: > On Wed, 26 Jan 2011 18:28:12 -0500, Jonathan M Davis > > wrote: > > I believe that it's supposed to take the common type of t1 and t2 and > > make the > > result an array of that type. So, assuming that the common type is T0, > >

Re: array of elements of various sybtypes

2011-01-26 Thread Steven Schveighoffer
On Wed, 26 Jan 2011 18:28:12 -0500, Jonathan M Davis wrote: I believe that it's supposed to take the common type of t1 and t2 and make the result an array of that type. So, assuming that the common type is T0, then it should work. However, it's not currently implemented that way. You coul

Re: array of elements of various sybtypes

2011-01-26 Thread Steven Schveighoffer
On Wed, 26 Jan 2011 18:33:45 -0500, spir wrote: On 01/26/2011 07:23 PM, Steven Schveighoffer wrote: On Wed, 26 Jan 2011 12:27:37 -0500, spir wrote: Hello, This fails: class T0 {} class T1 : T0 {} class T2 : T0 {} unittest { auto t1 = new T1(); auto t2 = new T2(); T0[] ts = [t1, t2]; } E

Re: concatenation

2011-01-26 Thread Daniel Murphy
"Ellery Newcomer" wrote in message news:ihl0vh$1n8v$1...@digitalmars.com... > in the following: > > void main(){ > char[] x; > string s; > string y; > > y = s ~ x; > } > > tok.d(5): Error: cannot implicitly convert expression > (cast(const(char)[])s ~ x) of type char[] to string > > why

Re: array of elements of various sybtypes

2011-01-26 Thread spir
On 01/27/2011 12:37 AM, bearophile wrote: spir: May feed be useful in std.array? Better to fix array litertals instead. Maybe, but (in this case) array literals are OK. We need a way to feed arrays according to a common supertype that may be the actual exact type of no provided element. N

Re: array of elements of various sybtypes

2011-01-26 Thread spir
On 01/27/2011 01:17 AM, Jesse Phillips wrote: Right, casting a /single/ element works: auto x = [cast(T0)(t1), t2]; auto y = [t1, cast(T0)(t2)]; So I guess it was implemented as "Common type within the given set." But to! fails: auto x = [to!(T0)(t1), t2]; auto y = [t1

Re: array of elements of various sybtypes

2011-01-26 Thread Jesse Phillips
> Right, casting a /single/ element works: > auto x = [cast(T0)(t1), t2]; > auto y = [t1, cast(T0)(t2)]; So I guess it was implemented as "Common type within the given set." > But to! fails: > auto x = [to!(T0)(t1), t2]; > auto y = [t1, to!(T0)(t2)]; > /usr/include/d/dmd/phob

Re: hex strings

2011-01-26 Thread Ellery Newcomer
On 01/26/2011 05:57 PM, spir wrote: On 01/26/2011 07:25 PM, Ellery Newcomer wrote: just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..." Super-nice for universal text. Anything you can't type in because of

Re: hex strings

2011-01-26 Thread Simen kjaeraas
spir wrote: Adds one char compared to D syntax, but allows partially hex-coded string: "blah #xx xxx# blah" I like having the ability to embed #'s in my strings, thank you. -- Simen

Re: hex strings

2011-01-26 Thread spir
On 01/26/2011 07:25 PM, Ellery Newcomer wrote: just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..." Super-nice for universal text. Anything you can't type in because of non-illimited keyboard size... Act

Re: array of elements of various sybtypes

2011-01-26 Thread spir
On 01/26/2011 07:29 PM, Jesse Phillips wrote: spir Wrote: Hello, This fails: class T0 {} class T1 : T0 {} class T2 : T0 {} unittest { auto t1 = new T1(); auto t2 = new T2(); T0[] ts = [t1, t2]; } Error: cannot implicitly convert expression (t1) of type __trials__.T0 to __t

Re: array of elements of various sybtypes

2011-01-26 Thread bearophile
spir: > May feed be useful in std.array? Better to fix array litertals instead. Bye, bearophile

Re: array of elements of various sybtypes

2011-01-26 Thread spir
On 01/26/2011 07:23 PM, Steven Schveighoffer wrote: On Wed, 26 Jan 2011 12:27:37 -0500, spir wrote: Hello, This fails: class T0 {} class T1 : T0 {} class T2 : T0 {} unittest { auto t1 = new T1(); auto t2 = new T2(); T0[] ts = [t1, t2]; } Error: cannot implicitly convert expression (t1) of

Re: array of elements of various sybtypes

2011-01-26 Thread spir
On 01/26/2011 07:26 PM, Steven Schveighoffer wrote: On Wed, 26 Jan 2011 12:30:17 -0500, spir wrote: On 01/26/2011 06:27 PM, spir wrote: Hello, This fails: class T0 {} class T1 : T0 {} class T2 : T0 {} unittest { auto t1 = new T1(); auto t2 = new T2(); T0[] ts = [t1, t2]; } Error: cannot i

Re: array of elements of various sybtypes

2011-01-26 Thread Jonathan M Davis
On Wednesday, January 26, 2011 15:07:09 spir wrote: > On 01/26/2011 07:32 PM, Jonathan M Davis wrote: > > On Wednesday, January 26, 2011 09:30:17 spir wrote: > >> On 01/26/2011 06:27 PM, spir wrote: > >>> Hello, > >>> > >>> This fails: > >>> > >>> class T0 {} > >>> class T1 : T0 {} > >>> class T2

Re: array of elements of various sybtypes

2011-01-26 Thread spir
On 01/26/2011 07:32 PM, Jonathan M Davis wrote: On Wednesday, January 26, 2011 09:30:17 spir wrote: On 01/26/2011 06:27 PM, spir wrote: Hello, This fails: class T0 {} class T1 : T0 {} class T2 : T0 {} unittest { auto t1 = new T1(); auto t2 = new T2(); T0[] ts = [t1, t2]; } Error: cannot imp

Re: github syntax hilighting

2011-01-26 Thread Andrej Mitrovic
On 1/26/11, Jacob Carlborg wrote: > It takes about 10 seconds to get syntax highlighting at the bottom of > the file in TextMate. Takes half a second in Scite, and in Vim I'm not noticing any delays. Incidentally I think I've seen the longest line count per file in Vim's codebase (close to 100k i

Re: D2 and gdb

2011-01-26 Thread vnm
On 01/26/2011 12:28 AM, Steven Schveighoffer wrote: On Tue, 25 Jan 2011 15:44:59 -0500, vnm wrote: Why gdb can't show line information and why it shows symbols in mangled form ? Is this software issues or I'm doing something wrong ? AFAIK, gdb 7.2 integrated some patch for D support (including

Re: hex strings

2011-01-26 Thread Jonathan M Davis
On Wednesday 26 January 2011 11:53:32 Ellery Newcomer wrote: > On 01/26/2011 01:35 PM, Jonathan M Davis wrote: > > On Wednesday, January 26, 2011 11:29:59 bearophile wrote: > >> Jonathan M Davis: > >>> That's legal? > >> > >> They are a part of D language, search for "Hex Strings" here: > >> http:

Re: github syntax hilighting

2011-01-26 Thread Jacob Carlborg
On 2011-01-26 20:30, Jonathan M Davis wrote: On Wednesday, January 26, 2011 11:21:55 Brad Roberts wrote: On 1/26/2011 7:13 AM, Steven Schveighoffer wrote: Anyone have any clue why this file is properly syntax-aware: https://github.com/D-Programming-Language/druntime/blob/master/src/rt/lif etim

Re: hex strings

2011-01-26 Thread bearophile
Simen kjaeraas: > > cast(ubyte[]) x"..." > > Never used them, tbh. But shouldn't that be > > cast(ubyte[]) x"...".dup Maybe it's to avoid such mistakes that C++ has const_cast separated from other casts. Bye, bearophile

Re: hex strings

2011-01-26 Thread Ellery Newcomer
On 01/26/2011 02:16 PM, Simen kjaeraas wrote: Ellery Newcomer wrote: just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..." Never used them, tbh. But shouldn't that be cast(ubyte[]) x"...".dup ? yeah,

Re: hex strings

2011-01-26 Thread Simen kjaeraas
Ellery Newcomer wrote: just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..." Never used them, tbh. But shouldn't that be cast(ubyte[]) x"...".dup ? -- Simen

Re: hex strings

2011-01-26 Thread Ellery Newcomer
On 01/26/2011 01:35 PM, Jonathan M Davis wrote: On Wednesday, January 26, 2011 11:29:59 bearophile wrote: Jonathan M Davis: That's legal? They are a part of D language, search for "Hex Strings" here: http://www.digitalmars.com/d/2.0/lex.html It always seems like there's at least one more th

Re: hex strings

2011-01-26 Thread Jonathan M Davis
On Wednesday, January 26, 2011 11:29:59 bearophile wrote: > Jonathan M Davis: > > That's legal? > > They are a part of D language, search for "Hex Strings" here: > http://www.digitalmars.com/d/2.0/lex.html It always seems like there's at least one more thing in the language that I have no idea

Re: hex strings

2011-01-26 Thread bearophile
Jonathan M Davis: > That's legal? They are a part of D language, search for "Hex Strings" here: http://www.digitalmars.com/d/2.0/lex.html Bye, bearophile

Re: github syntax hilighting

2011-01-26 Thread Jonathan M Davis
On Wednesday, January 26, 2011 11:21:55 Brad Roberts wrote: > On 1/26/2011 7:13 AM, Steven Schveighoffer wrote: > > Anyone have any clue why this file is properly syntax-aware: > > > > https://github.com/D-Programming-Language/druntime/blob/master/src/rt/lif > > etime.d > > > > but this file isn'

Re: github syntax hilighting

2011-01-26 Thread Brad Roberts
On 1/26/2011 7:13 AM, Steven Schveighoffer wrote: > Anyone have any clue why this file is properly syntax-aware: > > https://github.com/D-Programming-Language/druntime/blob/master/src/rt/lifetime.d > > but this file isn't > > https://github.com/D-Programming-Language/druntime/blob/master/src/cor

Re: hex strings

2011-01-26 Thread Jonathan M Davis
On Wednesday, January 26, 2011 10:25:29 Ellery Newcomer wrote: > just out of curiosity, does anyone use these and actually mean them to > be strings? It seems like I'm invariably writing > > cast(ubyte[]) x"..." That's legal? I thought that x went in front of hex literals, not strings. I wouldn'

Re: array of elements of various sybtypes

2011-01-26 Thread Jonathan M Davis
On Wednesday, January 26, 2011 09:30:17 spir wrote: > On 01/26/2011 06:27 PM, spir wrote: > > Hello, > > > > This fails: > > > > class T0 {} > > class T1 : T0 {} > > class T2 : T0 {} > > > > unittest { > > auto t1 = new T1(); > > auto t2 = new T2(); > > T0[] ts = [t1, t2]; > > } > > > > Error:

Re: array of elements of various sybtypes

2011-01-26 Thread Steven Schveighoffer
On Wed, 26 Jan 2011 12:30:17 -0500, spir wrote: On 01/26/2011 06:27 PM, spir wrote: Hello, This fails: class T0 {} class T1 : T0 {} class T2 : T0 {} unittest { auto t1 = new T1(); auto t2 = new T2(); T0[] ts = [t1, t2]; } Error: cannot implicitly convert expression (t1) of type __trials__.

Re: array of elements of various sybtypes

2011-01-26 Thread Jesse Phillips
spir Wrote: > Hello, > > This fails: > > class T0 {} > class T1 : T0 {} > class T2 : T0 {} > > unittest { > auto t1 = new T1(); > auto t2 = new T2(); > T0[] ts = [t1, t2]; > } > > Error: cannot implicitly convert expression (t1) of type __trials__.T0 to > __trials__.T2 > Error:

hex strings

2011-01-26 Thread Ellery Newcomer
just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..."

Re: github syntax hilighting

2011-01-26 Thread Jonathan M Davis
On Wednesday, January 26, 2011 07:13:38 Steven Schveighoffer wrote: > Anyone have any clue why this file is properly syntax-aware: > > https://github.com/D-Programming-Language/druntime/blob/master/src/rt/lifet > ime.d > > but this file isn't > > https://github.com/D-Programming-Language/druntim

Re: array of elements of various sybtypes

2011-01-26 Thread Steven Schveighoffer
On Wed, 26 Jan 2011 12:27:37 -0500, spir wrote: Hello, This fails: class T0 {} class T1 : T0 {} class T2 : T0 {} unittest { auto t1 = new T1(); auto t2 = new T2(); T0[] ts = [t1, t2]; } Error: cannot implicitly convert expression (t1) of type __trials__.T0 to __trials__.T2

Re: github syntax hilighting

2011-01-26 Thread Jesse Phillips
Well I found this, but it says the bug was fixed: http://support.github.com/discussions/site/157-syntax-highlighting-not-working-for-one-file Steven Schveighoffer Wrote: > Anyone have any clue why this file is properly syntax-aware: > > https://github.com/D-Programming-Language/druntime/blob/ma

Re: C# code sample

2011-01-26 Thread Jesse Phillips
Kagamin Wrote: > pragma Wrote: > > > i guess the D equivalent to IEnumerable is Range? how would it look like in > > D? > > Usually there's a little need for a range in such case. IEnumerable is > usually used because there's a high need for the List collection so it's used > even more often

Re: array of elements of various sybtypes

2011-01-26 Thread spir
On 01/26/2011 06:27 PM, spir wrote: Hello, This fails: class T0 {} class T1 : T0 {} class T2 : T0 {} unittest { auto t1 = new T1(); auto t2 = new T2(); T0[] ts = [t1, t2]; } Error: cannot implicitly convert expression (t1) of type __trials__.T0 to __trials__.T2 Error: cannot implicitly conver

array of elements of various sybtypes

2011-01-26 Thread spir
Hello, This fails: class T0 {} class T1 : T0 {} class T2 : T0 {} unittest { auto t1 = new T1(); auto t2 = new T2(); T0[] ts = [t1, t2]; } Error: cannot implicitly convert expression (t1) of type __trials__.T0 to __trials__.T2 Error: cannot implicitly convert expression ([(__error

github syntax hilighting

2011-01-26 Thread Steven Schveighoffer
Anyone have any clue why this file is properly syntax-aware: https://github.com/D-Programming-Language/druntime/blob/master/src/rt/lifetime.d but this file isn't https://github.com/D-Programming-Language/druntime/blob/master/src/core/thread.d I'm still not familiar at all with git or github...

Re: Interface problems

2011-01-26 Thread Steven Schveighoffer
On Wed, 26 Jan 2011 05:12:39 -0500, Dmitry Olshansky wrote: On 26.01.2011 8:12, Mandeep Singh Brar wrote: Mandeep Singh Brar: I am not able to: - find indexOf interface in an interface range using std.algorithm. I don't understand. Please explain better. In the following snippet: I

Re: C# code sample

2011-01-26 Thread bearophile
Kagamin: > Current druntime heap implementation already gives D arrays C# List > performance. What do you mean? Do you mean regarding appends, iteration, or what? Bye, bearophile

Re: C# code sample

2011-01-26 Thread Kagamin
pragma Wrote: > Hi i come from a c# background > > I would like to write the following code in the according D style but i'm not > sure howto do it > > c# code: > void foo(IEnumerable data) > { > foreach (var d in data) > { > do_some_stuff(d); > } > } > > i guess the D equivalent to I

Re: override '.' member access

2011-01-26 Thread spir
On 01/26/2011 01:06 AM, Simen kjaeraas wrote: spir wrote: On 01/25/2011 10:29 PM, Simen kjaeraas wrote: spir wrote: Hello, Cannot find corresponding opSomething method, if any. (opDispatch seems to specialise for method call.) Else, how to catch obj.member? opDispatch is likely what you

Re: override '.' member access

2011-01-26 Thread spir
On 01/26/2011 12:05 AM, spir wrote: On 01/25/2011 10:29 PM, Simen kjaeraas wrote: spir wrote: Hello, Cannot find corresponding opSomething method, if any. (opDispatch seems to specialise for method call.) Else, how to catch obj.member? opDispatch is likely what you want. with the @property

Re: Interface problems

2011-01-26 Thread Dmitry Olshansky
On 26.01.2011 8:12, Mandeep Singh Brar wrote: Mandeep Singh Brar: I am not able to: - find indexOf interface in an interface range using std.algorithm. I don't understand. Please explain better. In the following snippet: Interface interfaceA{} class C:interfaceA{} class D:in