Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!news.duke.edu!convex!cs.utexas.edu!math.ohio-state.edu!howland.reston.ans.net!torn!nott!cunews!dbuck
From: dbuck@superior.carleton.ca (Dave Buck)
Subject: Re: newbie asks about pointers
Message-ID: <D4J0r0.Dq7@cunews.carleton.ca>
Sender: news@cunews.carleton.ca (News Administrator)
Organization: Carleton University, Ottawa, Canada
References: <3ilfct$90f@sol.sun.csd.unb.ca>
Date: Fri, 24 Feb 1995 22:49:48 GMT
Lines: 40

In article <3ilfct$90f@sol.sun.csd.unb.ca>,
Michael Boothroyd CS <d4uc@jupiter.sun.csd.unb.ca> wrote:
>
>I've only done a superficial survey of SmallTalk, but have 
>been surprised by what I have not found: pointers.
>I don't like using them any more than anyone else, but they
>are useful.  What is the SmallTalk solution?

Smalltalk programmers don't talk about pointers.  That's not because
they don't exist - quite the opposite.  In Smalltalk every single
variable is a pointer to an object, so there's never any need to say it.

>My interest is in graph algorithms.  In C++ I have 
>a node class wihich contains a list of pointers to
>others of its class.  The trivial binary tree examples I have
>found in SmallTalk books have children that can be nil or trees
>themselves.  The question is, without a pointer to the parent,
>how can travel back up the tree? How do I change the root node? 
>They assume that the tree will node be manhandled.

There's nothing at all that dictates that you can't have a tree node
which contains a "pointer" to its parent.  In fact, I've implemented
such a tree many different times.  In this case, the implementation
may look very similar to the C++ implementation except that the "list"
of pointers is replaced with some more flexible collection from
Smalltalk's Collection's classes.

>thanks, mike.
>


David Buck
dbuck@ccs.carleton.ca

_________________________________
| David K. Buck                 |
| dbuck@ccs.carleton.ca         |
| The Object People             |
|_______________________________|

