swarm-support
[Top][All Lists]
Advanced

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

List semantics?


From: Barry McMullin
Subject: List semantics?
Date: Sat, 28 Sep 1996 12:54:55 +0000

And another thing...

I just found that the semantics of -getFirst on a list is (inter alia)
that it fails, crashing the program, if the list is empty.

I *expected* it would return nil instead.

Close scrutiny of the docs and code reveals the explanation as this:
-getFirst actually turns into -atOffset 0, and the (pedantically
correct and documented) behaviour for -atOffset is to crash if the
offset is >= current count (and yes, 0 is >= 0).

My main point is to warn other swarm neophytes before they get
caught out by this; but I also wonder if anyone has any views
on whether the semantics of this case shouldn't be *changed* to
returning nil?

Barry.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| Barry McMullin, Autonomous Systems Group,  |    address@hidden |
| School of Electronic Engineering,          |  Voice: +353-1-704-5432 |
| Dublin City University, Dublin 9, IRELAND. |  FAX:   +353-1-704-5508 |
| http://www.eeng.dcu.ie/~mcmullin/home.html |                         |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



reply via email to

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