NOOB Questions about this language

Ali Çehreli acehreli at yahoo.com
Mon Apr 22 17:19:51 PDT 2013


On 04/22/2013 04:45 PM, Wh1t3gh0st wrote:

 > Can anyone give me a list of ALL the types of primitive variables for
 > this language or show me where to go?
 >
 > Also if anyone can answer this can you also tell me if what category
 > they would fall into, like in C++ a bool would be a boolean or char is
 > mapping and short, int, and long are integer. Like that.

This page should be sufficient:

   http://dlang.org/type.html

The complex and imaginary types will not be supported for long because 
they will be replaced with library solutions in the future.

 > Can anyone tell me if this language uses static, dynamic, or both 
scoping?

Static.

 > Oh and does the D language have non-primitive data types?

'struct' and 'class' with different capabilities. This page has a 
comparison:

   http://dlang.org/struct.html

 > Does this language have a string type

Yes.

 > and if so is it static, dynamic

Bot.

 > with a fixed maximum length

Static arrays have exact length.

 >, or dynamic with no maximum lenght.

Yes.

There is also associative arrays.

 > Finally does this language allow single-dimisional, multidimensional
 > arrays, or no arrays at all?

There are static (aka fixed-length) arrays and there are dynamic arrays. 
The latter is also known as 'slice'.

No native support for multi-dimensional arrays but arrays of arrays (or 
slices of slices) are multi-dimensional.

strings are slices of Unicode code units. Most common is the 'string' 
type, which is nothing but a slice of UTF-8 code units, but strings can 
be of UTF-16 and UTF-32 code units. strings are under "Special Array 
Types" on this page:

   http://dlang.org/arrays.html

There is also the following article that goes into details of slices:

   http://dlang.org/d-array-article.html

Ali



More information about the Digitalmars-d mailing list