www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.ide
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



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

↑ ↓ ← 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
→ 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
"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
↑ ↓ → 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