Subject: Re: arrays really aren't - DN [1]


fellowsd@cs.man.ac.uk (Donal K. Fellows) - 17 May 1999 - comp.lang.tcl

 [ OK, I'm pulling your message apart.  I think it is easier to read
   that way, rather than keeping all the various comments to the end of
   the paragraph and requiring everyone to puzzle over just what
   sentence matches up to what. ]

 In article <3sJ%2.3747$G3.151326@news14.ispnews.com>,
 Bryan Kelly <kellyb@brevard.net> wrote:
 > I find that tcl violates many many of these hard earned concepts.

 Computers are more flexible than you (and many others) believe.

 > Misspelled variables can be extremely difficult to detect in large
 > sections of code written by someone else.

 True.  It's a tough enough job with a declare-everything-first
 language...

 > Sub functions have absolutely no business declaring a global
 > variable for its parent.

 I suspect this is a philosophical point.  You won't like Lisp either.

 > Why the heck can't I put that
 > brace on the next crummy line without a continuation character.

 Because Tcl *strongly* encourages you to do it The Right Way using
 OTB!  :^)

 > And
 > finally, I continue to cling to my conclusion that there are no arrays in
 > tcl.  If there were, then array( 1,2 ) would index the same element as
 > array(1,2).  FORTRAN has shown very well that the use of blank spaces like
 > this is NOT a good idea.

 You are obviously under the misconception that arrays have to have
 numeric-list indices in Tcl.  This is not the case.  Arrays are a
 *general* string -> string mapping mechanism.  [set foo(bar) spong] is
 perfectly legal.  Having leading and trailing spaces be significant in
 array indices are just a consequence of that larger reality.

 Of course, if you are *defining* arrays as only ever being int list ->
 string mappings (as they are in FORTRAN or C) then you are absolutely
 right; Tcl does not have arrays.  In our opinion, it doesn't need them
 crucially either.  (You can get a fair bit if the effect of arrays
 with lists in Tcl8.  Things only get awkward when you want more than
 one dimension, and that turns out to be relatively rare in practise.)

 > However, please don't forget the appreciation I have for the help I received
 > here,

 It is very nice to be appreciated, isn't it everyone?

 Donal.
 --
 Donal K. Fellows    http://www.cs.man.ac.uk/~fellowsd/    fellowsd@cs.man.ac.uk
 -- The small advantage of not having California being part of my country would
    be overweighed by having California as a heavily-armed rabid weasel on our
    borders.  -- David Parsons  <o r c @ p e l l . p o r t l a n d . o r . u s>

Last modified
1999-09-27

(195.108.246.50)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated