digitalmars.D - Request!? why i can't do these things in d????
- d user. (4/4) May 04 2008 1) implicit constructor conversion like in c++
- Ary Borenszweig (8/11) May 04 2008 I don't know why, but I guess it's because searching a symbol in a
- Jarrett Billingsley (21/23) May 04 2008 This behavior is usually only useful for value types. Value types in D ...
- Walter Bright (3/8) May 08 2008 I suggest instead creating an "all.d" file that consists of just a bunch...
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
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
"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
Jarrett Billingsley wrote:I suggest instead creating an "all.d" file that consists of just a bunch of imports that are needed, then just import all;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 08 2008