resizeable arrays: T[new]

Daniel Keep daniel.keep.lists at gmail.com
Mon Jun 4 06:06:34 PDT 2007



Daniel Keep wrote:
> ...
> A few possible alternatives:
> 
> T[new]	// Proposed
> T[$]	// Since $ already means "length" for arrays
> T[*]	// Indicating the index could be anything
> T[..]	// Bit of a stretch...
> T[volatile] // Bit long
> T[[]]	// Just ugly

One thing that didn't occur to me until just now is that T[$], T[*],
T[~] (and someone suggested T[?] on IRC) require you to alternate the
use of the shift key.  This means that I keep accidentally typing T[$}
or T{$] or T[4}.

I do think that T[*] is probably the nicest looking without giving the
wrong initial impression (T[$] could be misinterpreted as a typo, as
could T[..]), but is tricky to type quickly.  T[..] is easy to type
fast, as is T[new].

Another thing to consider is that T[*] requires your hands to move
further than either T[$] or T[..].

A few other possible symbols that can be entered without using shift (at
least on my keyboard):

T[.]
T[,]
T[`]
T[-]
T[=]
T[;]

I'm not counting keys on the numeric keypad because it's too far away
from the usual resting position of the hands.

Just something to chew on :)

	-- Daniel



More information about the Digitalmars-d-announce mailing list