Creating an array of user-defined structs

Jesse Phillips via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 22 13:39:42 PDT 2016


On Monday, 22 August 2016 at 07:00:23 UTC, brian wrote:
> On Monday, 22 August 2016 at 06:19:00 UTC, Mike Parker wrote:
>> Terminology wise, we distinguish between associative arrays 
>> (AA) and arrays. The former should never simply be called 
>> 'array', otherwise people will assume you are referring to 
>> either or both of foo[] (dynamic array/slice) or foo[N] (where 
>> N is an integer constant, a static array). Change your title 
>> to 'Creating an AA of user-defined structs' and the 
>> misunderstanding goes away.
>
> That's a terribly confusing naming convention for beginners 
> then! :P
> Is this D-specific terminology, or is this a more general 
> convention that AA are not actually arrays?
> This might help my understanding of when to use or not use one 
> or the other. :)

Listen to Mike. This is not specific to D and they are only 
arrays in name.

I want to provide other examples because I think I come across 
this with other words in English. Where one thing uses the name 
of another, but there really isn't enough similarities that it 
would make sense to refer to them in the same bucket.

In your case though it is similar to square vs rectangle. If you 
are trying to understand some properties about squares, you could 
talk about having a rectangle, but it is more helpful to be 
specific. Consider asking how to find the area of a rectangle, 
you'll get the answer "length * height" while asking to finding 
the area of a square you might get "length^2"


More information about the Digitalmars-d-learn mailing list