Re: Problems with Reflection in Static library

2010-12-18 Thread Tomek Sowiński
Mandeep Singh Brar napisał: I have a class A in module testD as follows module testD; import std.stdio; public class A { public this() { writeln(const); } public void a(string l, int k) { writeln(Hello B.a, l, k); } } I have

list of anything

2010-12-18 Thread spir
Hello, In Lisp-like languages, a list can hold anything: (1 a (1 a)) I do not find it trivial to simulate this in D. Using a linked list or an array: the issue is not with the kind of collection but with elements. In either case, I guess, elements should actually be void* pointers. But

Re: list of anything

2010-12-18 Thread Tomek Sowiński
spir napisał: In Lisp-like languages, a list can hold anything: (1 a (1 a)) I do not find it trivial to simulate this in D. Using a linked list or an array: the issue is not with the kind of collection but with elements. In either case, I guess, elements should actually be void*

Re: list of anything

2010-12-18 Thread David Nadlinger
On 12/18/10 1:16 PM, spir wrote: But I could not find a way to do that, instead get weird error messages like eg 'int' is not a value (so, what else?). It is a type, and as such a compile-time entity rather than a runtime value. You might want to have a look at »typeid()« though, which returns

opAssign work not with initialisation?

2010-12-18 Thread spir
Hello, struct S { int value; void opAssign(int value) { this.value = value; } } unittest { S s1; s1 = 3; // OK S s2 = 3; // _build_ error } == Element.d(105): Error: cannot implicitly convert expression (3) of type int to S Do I miss something? And why not

Re: opAssign work not with initialisation?

2010-12-18 Thread Adam Burton
spir wrote: Hello, struct S { int value; void opAssign(int value) { this.value = value; } } unittest { S s1; s1 = 3; // OK S s2 = 3; // _build_ error } == Element.d(105): Error: cannot implicitly convert expression (3) of type int to S Do I

define methods apart

2010-12-18 Thread spir
Hello, I cannot find a way to define methods (I mean member functions) outside the main type-definition body: struct X {} void X.say () {writeln(I say!);} == Element.d(85): semicolon expected, not '.' Do I overlook anything, or is this simply impossible? In the latter case, what is the

Re: Problems with Reflection in Static library

2010-12-18 Thread spir
On Sat, 18 Dec 2010 13:07:41 +0100 Tomek Sowiński j...@ask.me wrote: BTW, am I the only one to think Object.factory is a bad name? It doesn't return a factory. Sure, one can get used to it, but why not Object.make or .create or .instance? You're not the only one ;-) Similar to index(ing)

Re: list of anything

2010-12-18 Thread spir
On Sat, 18 Dec 2010 13:35:21 +0100 David Nadlinger s...@klickverbot.at wrote: But I could not find a way to do that, instead get weird error messages like eg 'int' is not a value (so, what else?). It is a type, and as such a compile-time entity rather than a runtime value. You might

Re: opAssign work not with initialisation?

2010-12-18 Thread spir
On Sat, 18 Dec 2010 13:08:14 + Adam Burton adz...@gmail.com wrote: struct S { int value; void opAssign(int value) { this.value = value; } } unittest { S s1; s1 = 3; // OK S s2 = 3; // _build_ error } == Element.d(105): Error: cannot

Re: define methods apart

2010-12-18 Thread bearophile
spir: Do I overlook anything, or is this simply impossible? Even if you find some trick to do it, it's not the D way. A language syntax is defined by its conventions too. Bye, bearophile

Re: list of anything

2010-12-18 Thread bearophile
spir: i understand this, but many elements are compile-time things and still available at runtime: all consts, static, enum... and all funcs! Seems only types vanish. Right. They traditionally vanish because most times you don't need them, so you save both some memory and computations at

Re: Problems with Reflection in Static library

2010-12-18 Thread Kagamin
Mandeep Singh Brar Wrote: The Object.factory method does not seem to work if my class has been compiled as a static library. Can you please let me know how to solve this. I have tried replacing public with export for class testD, but that does not help. The class A is not referenced from

Segmentation faults on Linux

2010-12-18 Thread Bob Cowdery
Hi I'm in the middle of porting a working D with C application from Windows to Linux (Ubuntu 10.04). I've been tracking down segmentation faults and it seems that any pointer reference from C back to D is causing a crash. Even passing the address of an int causes a segmentation fault when the

Re: define methods apart

2010-12-18 Thread Jonathan M Davis
On Saturday 18 December 2010 05:19:56 spir wrote: Hello, I cannot find a way to define methods (I mean member functions) outside the main type-definition body: struct X {} void X.say () {writeln(I say!);} == Element.d(85): semicolon expected, not '.' Do I overlook anything, or is

sleepy receiveTimeout?

2010-12-18 Thread Joost 't Hart
Hi, (also posted on news.gmane.org, but does not seem to appear there) New to this group and to D, but getting into it fast. Came across a problem. 2.050 / Linux 1) On windows we can get any (std.concurrency, which is what I use in my project) thread to sleep using Sleep() from

Re: sleepy receiveTimeout?

2010-12-18 Thread Jonathan M Davis
On Saturday 18 December 2010 13:22:52 Joost 't Hart wrote: Hi, (also posted on news.gmane.org, but does not seem to appear there) New to this group and to D, but getting into it fast. Welcome! Came across a problem. 2.050 / Linux 1) On windows we can get any (std.concurrency, which

Re: sleepy receiveTimeout?

2010-12-18 Thread Joost 't Hart
On 12/18/2010 10:46 PM, Jonathan M Davis wrote: On Saturday 18 December 2010 13:22:52 Joost 't Hart wrote: Hi, (also posted on news.gmane.org, but does not seem to appear there) New to this group and to D, but getting into it fast. Welcome! Came across a problem. 2.050 / Linux 1) On

string comparison

2010-12-18 Thread doubleagent
Andrei's quick dictionary illustration [in his book, 'The D Programming Language'] doesn't seem to work. Code attached. On my computer, with d2-0.5.0, I got the following output while testing. andrei 0 andrei andrei 1 andrei Also, why doesn't 'splitter' show up on the site's

Re: Problems with Reflection in Static library

2010-12-18 Thread Mandeep Singh Brar
Thanks a lot for your reply Tomek. I understand what you are saying but this would not work for me. The reason is that i am trying to make some kind of plugins from these libs. So i would not know the name objectFactory also in advance (multiple plugins will not be implementing the same named