swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what's wrong with this use of the index to clean a list?


From: glen e. p. ropella
Subject: Re: what's wrong with this use of the index to clean a list?
Date: Thu, 28 Oct 1999 08:20:40 -0700

At 11:23 PM 10/27/99 -0500, you wrote:
Should the program be testing every "member" to see if it is not nil?
Without doing that, I suppose I would expect a crash at run time saying
"nil does not respond to doSomething"?  But I have not seen such a
crash.

I don't really know if this is related; but, awhile back,
I wanted to use the Array class and, quite reasonably
I thought, wanted to put "0" as a member in my arrays.
But, while it would let me put "0" in, it wouldn't let
me test for its presence with a "contains:" query.
"contains:" is implemented in the Collections.m file
and List doesn't seem to override that method.

But, there's a larger issue at stake, here.  By
forcing one to avoid putting nils in Lists, you
would be introducing a bias towards using Lists
to only contain objects, rather than (possibly
null valued) other things.  Is this really what
you want to do?

As Jason points out, it's almost always the case that a
message that's passed to nil indicates an error in the
program.  But, there just might be better ways of helping
the programmer avoid these errors than putting restrictions
in either the language or Swarm's collections.

One of those ways is to make use of the compiler Warnings,
which is not so easy for us to do.  Another way would be
to provide, in for example the collections library, run-time
WarningMessages letting you know about things like adding
nils to lists or sending messages to nils.  But, most people
don't use very sophisticated output tracing to make that
convenient (for example, a seasoned programmer will usually
pipe error output to a file, warning output to a file, and
standard output to a file and the terminal...usually with
some markers for a graduated scale of errors, etc.).
And that means that a bunch of WarningMessages would annoy
somebody giving a demo to their boss.

This is all due to a lack of a sophisticated exception
handling mechanism.  We started building one a long time
ago (Nelson actually started it... and I didn't continue
it -- sorry).  Should we take the time and effort to
develop one?  Or should we just state that, those who
want one should use... say... Java?  And those who program
in ObjC should know better?

Any thoughts?

glen
p.s. This whole message is working from the axiom of
an incomplete collections library.  There are a number of
reasons we haven't completed the library, not all of them
technical; but the fact is that it's incomplete.  Again,
the question arises of how much effort we want to put into
the possibly obsolete fluff around the ObjC 'kernel' or
whether we want to take our *hydra* plan seriously and
utilize the helpful structures in other languages.
--
glen e. p. ropella =><= Feeding the hamster wheel.  Hail Eris!
Home: http://www.trail.com/~gepr                (505) 424-0448
Work: http://www.swarm.com                      (505) 995-0818

                 ==================================
  Swarm-Support is for discussion of the technical details of the day
  to day usage of Swarm.  For list administration needs (esp.
  [un]subscribing), please send a message to <address@hidden>
  with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]