Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!mcvax!botter!tjalk!dick From: dick@tjalk.UUCP (Dick Grune) Newsgroups: net.lang Subject: The Naming of Arrays Message-ID: <587@tjalk.UUCP> Date: Mon, 2-Jun-86 12:11:24 EDT Article-I.D.: tjalk.587 Posted: Mon Jun 2 12:11:24 1986 Date-Received: Wed, 4-Jun-86 07:51:29 EDT Organization: VU Informatica, Amsterdam Lines: 54 Summary: Are the names of arrays singular, plural, or other? This may not be the most important thing in the world, but I like the names of entities in my program to be so clear that I can still tell what I meant by them a year from now. (Sounds good, doesn't it?) Now arrays always give me some problems. Say I need an array of words; first I intuitively declare them as (examples are from C, but you get the same in Pascal, Ada or WhatNot :-) struct word words[N_WORDS]; but then I need the n-th element, I write words[n] and I think it sounds funny, since I do not want "words n" but "word n", not the n-th words, but the n-th word. So I change the declaration to struct word word[N_WORDS]; which now looks funny, but then there is only one of them, and I can now freely write word[4] . (I agree that this account rambles, but I do not write this to get an A in journalism.) After a while, however, I begin to regret that I have used up my precious singular form of the word for a relatively little used item, the array. I can no longer write locally for (i = 0; i < N_WORDS; i++) { struct word word = word[i]; ... } and I resort to constructions like struct word wordi = word[i]; or struct word wrd = word[i]; Lately I've been using struct word word_array[N_WORDS]; and struct word word = word_array[i]; but I'm not really enthousiastic either. To my feeling this gets worse if the plural is irregular: children[4] looks a lot more odd to me than child[4]. I think it is even worse in languages where the formation of plurals is more prominent than in English; the German form "Woerter[4]" is absurd compared to "Wort[4]" (I think). Has anybody out there given this some explicit thought? How do YOU name your arrays? Dick Grune Vrije Universiteit de Boelelaan 1081 1081 HV Amsterdam the Netherlands