Philip White
unread,Nov 16, 2009, 9:46:41 PM11/16/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Programming Nu
Hello,
I hope I'm not too late hopping on this Nu bandwagon. I really enjoy
working (playing mainly, so far) in this language and exploring its
inner workings. I hope it continues to be enthusiastically used and
supported by the community.
I was wondering if I am correct in believing that Nu is missing a
way to tell if two objects are identical (i.e. the same instance;
occupy the same place in memory). Much as Common Lisp has several ways
to make comparisons (eq, eql, etc.), this could be a valuable addition
to Nu. Or maybe I'm just overlooking something. I looked through the
source but couldn't find any such thing.
So maybe that's a trivial point, it certainly isn't difficult to add
a category to NSObject in Objective C to add that behavior, but I
think the profound thing is that without it it makes certain things
impossible to do in Nu.
For instance: consider circular lists. NuCell has several methods
that don't behave well with circular lists; in fact, it crashes Nu
entirely to try to compare a circular list to itself. If you try,
isEqual: recurses indefinitely until KABOOM! But more importantly,
since you can't compare NuCells that are elements in circular lists, I
don't think there is anyway to use Nu to test if a list is circular.
Of course, maybe a circular list is one of those things that doesn't
need to exist, or if you need one, you should make a custom class to
implement it. But the fact is you can create one easily in Nu, maybe
accidentally, and then you have a very dangerous object floating
around.
Heck, why not revamp NuCell's various method so that they behave OK
with circular lists? Some of them, like -lastObject, might just throw
an exception if it detects a circular list; others, like isEqual:,
could compare circular lists correctly without too much difficulty. I
don't think this would be too much of a performance hit. I'll run some
tests to see (sounds fun!).
Anyway, in my unsolicited opinion, I think Nu needs to ability to test
for identicality (is that a word? and do please let me know if there
is a way I missed) and NuCell should handle circular lists gracefully.
Thanks for all of your time and Tim, thanks for making this awesome,
inspired language.
-Philip White