Variables of struct and class types are called objects - discuss - spec

Nick Treleaven nick at geany.org
Mon Aug 4 15:13:19 UTC 2025


On Monday, 4 August 2025 at 02:47:47 UTC, Jonathan M Davis wrote:
> The spec does use the term "aggregate type" to refer to 
> classes, structs, interfaces, and unions, since they're all 
> aggregates of values. However, from what I've seen, the term 
> isn't used very often outside of the spec, and I don't think 
> that I've ever seen the term "aggregate instance" before. From 
> what I've seen, instances of both structs and classes are 
> routinely referred to as objects.

The Structs page uses `object` quite a lot.

> Regardless, it's not like we have a precise definition of what 
> "object" means in D in the spec anywhere AFAIK.

To complicate matters, the spec sometimes uses 'object' just to 
mean an instance of any type:

> If a pointer contains a null value, it is not pointing to a 
> valid object.

https://dlang.org/spec/type.html#pointers

Note: git blame has my name on those lines, because I moved them 
there from arrays.dd. I think there are other places in the spec 
too but I've not found them after a quick look. Anyway that 
section could be fixed.


More information about the Digitalmars-d-learn mailing list