Re: MS ODBC encoding issue

2012-12-05 Thread Regan Heath
On Wed, 05 Dec 2012 03:29:50 -, Sam Hu samhudotsa...@gmail.com wrote: On Tuesday, 4 December 2012 at 10:05:16 UTC, Nathan M. Swan wrote: I've never used ODBC before, but a quick scan of the MSDN docs suggests that you should use SQL_C_WCHAR instead, maybe using some D wstring

Re: Type polymorphism and type variance

2012-12-05 Thread Lubos Pintes
Sorry maybe I am stupid but where is the value of concrete T? Or perhaps I completely misunderstood this? Dňa 5. 12. 2012 4:59 Ali Çehreli wrote / napísal(a): On 12/04/2012 06:42 PM, js.mdnq wrote: One thing I've always struggled with in oop is how to deal with storing generic types. A

Re: opEquals for same type

2012-12-05 Thread deed
What I know about this topic is in the following chapter: http://ddili.org/ders/d.en/object.html Ali Thanks, Ali. That clarifies why it worked with opCmp and not with opEquals.

Re: Calls to struct methods and immutable

2012-12-05 Thread Joseph Rushton Wakeling
On 11/30/2012 05:45 AM, Ali Çehreli wrote: I've forced it pretty hard: :D immutable(Network) idup() pure const @property { Node[uint] nodesCopy; foreach (key, node; nodes) { immutable(Node) nodeCopy = node.idup; nodesCopy[key] =

Appending immutable char implicit cast to int, bug or feature?

2012-12-05 Thread ixid
This is simple code to create all genetic combinations from two organisms. string[] mixGenes(string a, string b) { string[] result; foreach(i;0..2) foreach(j;0..2) foreach(k;2..4) foreach(m;2..4)

Appending immutable char implicit cast to int, bug or feature?

2012-12-05 Thread ixid
This is simple code to create all genetic combinations from two organisms. string[] mixGenes(string a, string b) { string[] result; foreach(i;0..2) foreach(j;0..2) foreach(k;2..4) foreach(m;2..4)

Re: Type polymorphism and type variance

2012-12-05 Thread js.mdnq
On Wednesday, 5 December 2012 at 03:59:29 UTC, Ali Çehreli wrote: On 12/04/2012 06:42 PM, js.mdnq wrote: One thing I've always struggled with in oop is how to deal with storing generic types. A very simple example is, suppose you had to design a way to store generic types. class

Re: Template return values?

2012-12-05 Thread Dmitry Olshansky
12/5/2012 5:40 AM, Jonathan M Davis пишет: On Tuesday, December 04, 2012 23:28:25 Dmitry Olshansky wrote: 12/4/2012 10:40 PM, Jonathan M Davis пишет: On Tuesday, December 04, 2012 21:43:09 Dmitry Olshansky wrote: Well TDPL claims multiple alias this is allowed so in some distant future it

Re: Type polymorphism and type variance

2012-12-05 Thread Ali Çehreli
On 12/05/2012 04:28 AM, Lubos Pintes wrote: where is the value of concrete T? Or perhaps I completely misunderstood this? Maybe I misunderstand you. :) Are you pointing out that the class template that I have shown did not have any member variables? If so, they can have anything they want.

Re: Getting memory size of class

2012-12-05 Thread Simen Kjaeraas
On 2012-12-05, 20:03, js.mdnq wrote: sizeof always returns 4 or 8 regardless of size of class: class myclass(T) { public: T v1; T v2; T v3; T v4; T v5; T v6; } writeln((myclass!byte).sizeof, (myclass!double).sizeof); or even

Re: Getting memory size of class

2012-12-05 Thread Mike Wey
On 12/05/2012 08:03 PM, js.mdnq wrote: sizeof always returns 4 or 8 regardless of size of class: class myclass(T) { public: T v1; T v2; T v3; T v4; T v5; T v6; } writeln((myclass!byte).sizeof, (myclass!double).sizeof); or even

Re: Template return values?

2012-12-05 Thread Jonathan M Davis
On Wednesday, December 05, 2012 22:07:48 Dmitry Olshansky wrote: 12/5/2012 5:40 AM, Jonathan M Davis пишет: There's nothing natural about Variant. It's attempting to add dynamic typing to a statically typed language. Bleh that smells religious. There are cases where one may just go for it

Re: opEquals

2012-12-05 Thread Dan
On Wednesday, 5 December 2012 at 00:17:05 UTC, deed wrote: interface I { bool opEquals(I i); } class C : I { bool opEquals(I i) { return true; } } void main() { I i1 = new C; I i2 = new C; assert(i1 == i2); // Assertino failure assert(i1 != i2); //

Re: Template return values?

2012-12-05 Thread Dmitry Olshansky
12/5/2012 11:31 PM, Jonathan M Davis пишет: On Wednesday, December 05, 2012 22:07:48 Dmitry Olshansky wrote: 12/5/2012 5:40 AM, Jonathan M Davis пишет: There's nothing natural about Variant. It's attempting to add dynamic typing to a statically typed language. Bleh that smells religious.

Re: Template return values?

2012-12-05 Thread Era Scarecrow
On Tuesday, 4 December 2012 at 17:43:21 UTC, Dmitry Olshansky wrote: Well TDPL claims multiple alias this is allowed so in some distant future it maybe possible for Varaint to alias this to all built-in types. Maybe I remember back when I was originally reading about C++ and

Re: Template return values?

2012-12-05 Thread Era Scarecrow
On Wednesday, 5 December 2012 at 21:39:31 UTC, Era Scarecrow wrote: My god did it finally post? Sorry if it repeated a few times... Left it on easily overnight and it still didn't say it posted any of it. :(

Re: Template return values?

2012-12-05 Thread Jonathan M Davis
On Thursday, December 06, 2012 01:06:33 Dmitry Olshansky wrote: To know what on earth you're suposed to do with the variable. If it's a type that you can't handle, then yes, you'd probably have to throw an exception, but you generally use a Variant because you need to be able to return

Re: Type polymorphism and type variance

2012-12-05 Thread js.mdnq
On Wednesday, 5 December 2012 at 22:53:11 UTC, Ali Çehreli wrote: On 12/05/2012 09:51 AM, js.mdnq wrote: (if your having trouble understanding the problem then just think of how you would efficiently store the nodes and edges of a directed acyclic graph. Each node is of a somewhat arbitrary

Re: MS ODBC encoding issue

2012-12-05 Thread Sam Hu
On Wednesday, 5 December 2012 at 11:33:16 UTC, Regan Heath wrote: On Wed, 05 Dec 2012 03:29:50 -, Sam Hu samhudotsa...@gmail.com wrote: On Tuesday, 4 December 2012 at 10:05:16 UTC, Nathan M. Swan wrote: I've never used ODBC before, but a quick scan of the MSDN docs suggests that you

Re: MS ODBC encoding issue

2012-12-05 Thread Sam Hu
Known issues: Under console reading Access table recordsets works fine ,inserting a new record which contains only English characters works fine as well,but inserting new record which contains Chinese character will crash; If calling the fetchAll in a DFL gui form and try to display the

Re: Type polymorphism and type variance

2012-12-05 Thread Ali Çehreli
On 12/05/2012 04:40 PM, js.mdnq wrote: On Wednesday, 5 December 2012 at 22:53:11 UTC, Ali Çehreli wrote: On 12/05/2012 09:51 AM, js.mdnq wrote: (if your having trouble understanding the problem then just think of how you would efficiently store the nodes and edges of a directed acyclic

Re: Template return values?

2012-12-05 Thread Era Scarecrow
On Wednesday, 5 December 2012 at 19:32:03 UTC, Jonathan M Davis wrote: Yes, but that inevitably forces you to check the type in order to handle it correctly, which means that implicit conversion just doesn't work. In order for implicit conversion to work, you have to be able to assume that

Re: Appending immutable char implicit cast to int, bug or feature?

2012-12-05 Thread Ali Çehreli
On 12/05/2012 09:30 AM, ixid wrote: This is simple code to create all genetic combinations from two organisms. string[] mixGenes(string a, string b) { string[] result; foreach(i;0..2) foreach(j;0..2) foreach(k;2..4) foreach(m;2..4) result ~= [a[i]] ~ [b[j]] ~ [a[k]] ~ [b[m]]; return result; }