Variables of struct and class types are called objects - discuss

Brother Bill brotherbill at mail.com
Sun Aug 3 11:11:43 UTC 2025


In Programming in D book, page 247, it is written:  Variables of 
struct and class types are called objects.

This struck me as odd and confusing.  I have always been taught 
that objects are instances of classes.  That is, new MyClass 
creates an instance or object of MyClass.

There was a wall between value types and reference types.
Of course structs and class types are both user defined types, 
but one with value semantics and the other with reference 
semantics.

Given that most languages support both user defined value types 
and user defined reference types, that D use the same term for 
both instances.

Am curious whether experienced D developers actually refer to 
both struct and class variables as "objects" without confusion.

Is this something that most D newbies struggle over?

Please assist with my "deprogramming" from "objects" being only 
for reference types.

Thank you.


More information about the Digitalmars-d-learn mailing list