www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Request!? why i can't do these things in d????

reply d user. <cortigenb6 yahoo.com> writes:
1) implicit constructor conversion like in c++
2)import with *  like in java import  xx.xx.*
3)char[10] s=new char[10]{a,b,c,d,.....};
thanks
May 04 2008
next sibling parent Ary Borenszweig <ary esperanto.org.ar> writes:
d user. escribió:
 1) implicit constructor conversion like in c++
I don't know what is it.
 2)import with *  like in java import  xx.xx.*
I don't know why, but I guess it's because searching a symbol in a package in D is not like searching a type in a package in Java. In Java you just need to look for a file named like the type, while in D you need to parse the whole module, maybe do semantic analysis, and then see where the symbol is.
 3)char[10] s=new char[10]{a,b,c,d,.....};
char[10] c = [ 'a', 'b', 'c', ... ];
May 04 2008
prev sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"d user." <cortigenb6 yahoo.com> wrote in message 
news:fvlmpo$2bgq$1 digitalmars.com...
 1) implicit constructor conversion like in c++
This behavior is usually only useful for value types. Value types in D are handled by structs, not classes. And for structs, there is the (really really questionable design..) static opCall: struct S { int value; static S opCall(int x) { S ret; ret.value = x; return ret; } } ... S s = 5; // equvalent to S s = S(5) D2 will be introducing proper constructors for structs.
 2)import with *  like in java import  xx.xx.*
Ask most Java or Python programmers and you'll get a response similar to that of "goto". They're questionably useful and tend to lead to sloppy style, unclear dependencies, and longer compile times.
May 04 2008
parent Walter Bright <newshound1 digitalmars.com> writes:
Jarrett Billingsley wrote:
 2)import with *  like in java import  xx.xx.*
Ask most Java or Python programmers and you'll get a response similar to that of "goto". They're questionably useful and tend to lead to sloppy style, unclear dependencies, and longer compile times.
I suggest instead creating an "all.d" file that consists of just a bunch of imports that are needed, then just import all;
May 08 2008