Why there are no 'physical' object variables (only references)?
Kristian
kjkilpi at gmail.com
Sun Sep 10 07:55:54 PDT 2006
On Sun, 10 Sep 2006 16:09:23 +0300, Frits van Bommel
<fvbommel at REMwOVExCAPSs.nl> wrote:
[snip]
>> The 'Coord' objects have no 'global meaning' here, they are just
>> simple values used in calculations. (So there is no need to reference
>> them from other parts of the code.)
>> I think it's a big restriction if a language does not have both the
>> variable types (physical + references).
>> Why D and other similar languages have no physical types?
>
> I think D structs are the "physical" variable type you're looking for.
> They allow everything above.
[snip]
Ah, of course, basic types can be usually implemented as structures,
thanks. :)
Unfortunately some of the types have to be implemented as classes (e.g. a
file class) because of the inheritance and/or constructors/destructors.
Hmm, what if structures could have interfaces and
constructors/destructors... and what the heck, inheritance too? Hehheh,
this way we would have 'physical classes' for local use and 'reference
classes' for global use. Or we could have a new data type instead:
type Coord {...} //like a class except its objects do not use referencing
That would be weird... or would it?
More information about the Digitalmars-d
mailing list