From: Dossy Date: 2002-07-08T07:09:06+09:00 Subject: Re: is there a better string.each? On 2002.07.08, Tom Sawyer wrote: > > Yes, quite right. A linked list is also an > > ordered collection of items. Yet we wouldn't > > say that a string "is a" linked list. > > > > Hal Fulton > > not to be mean, but this is just the worst logic: > > "Yes, quite right. A *cat* is also an *animal*. > Yet we wouldn't say that a *parrot* "is a" *cat*." > > no one has said anything to the effect that a string is a linked list. If the language you're working in implemented Arrays as a doubly-linked list unbeknownst to you. Then a String would, therefore, be a doubly-linked list. No? What if you were programming in a language that ran on a machine whose memory was not linearly addressable -- or, at least, it was only linearly addressable in pages, suppose 4KB at a clip. Then, "long" strings (those longer than 4KB) would clearly be a List of Arrays of Characters to you, right? (The List of course consisting of Pages of memory holding Arrays of Characters up to 4KB in length.) Of course, trying to convince any "sane" person (who had never worked on such a platform in such a language) that Strings were really Lists of Arrays (or Arrays of Arrays) would make you sound totally uneducated or ridiculous. We all understand a language (English or otherwise). We all understand what "Strings" are. Ask any lay-person what a "String" is and they can tell you: some object that has a start and an end and is generally used to tie two objects together. Generally, people String words together to form Sentences -- this is their useful purpose. Shouldn't we model Strings to better represent their useful purpose, rather than their machine-specific implementation detail? -- Dossy -- Dossy Shiobara mail: dossy@panoptic.com Panoptic Computer Network web: http://www.panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)