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

"delete" and the Smalltalk translator



Does the following change to the translator seem reasonable to
everyone? 

Currently, if one wants to delete an object that is held onto by a
CHKPTR or a SPTR (or worse, the result of an expression...), what we
write in smalltalk now is:

	| tmp {Heaper *} |

	...

	tmp <- (expr).
	tmp delete.

Which translates to something like:

	Heaper * tmp;

	...

	tmp := (expr);
	delete &* tmp;

What we'd all like to write (I assume) is:

	(expr) delete.

But niether

	delete &* (expr);

nor

	delete (expr);

will currently compile due to inadequacies in cfront 2.0.  We could
simple have:

	(expr) delete.

translate to:

	Heaper * tmp;
	tmp = (expr);
	delete tmp;

except that we would then not be able to delete non-Heapers (or, at
least, non-Tofus).  The suggested change to the translator is to have

	(expr) destroy.

translate to

	Heaper * tmp;
	tmp = (expr);
	delete tmp;

and have

	(expr) delete.

translate to

	delete (expr);

thereby also getting rid of the current annoying warning about
deleting an "&" expression.

We would then use "destroy" instead of "delete" on all things which
were kinds of Heapers.  One suspects that this problem may be fixed in
cfront 2.1, in which case we can simply fix the translator.

What do you guys think?  If I hear no objections, I'll probably do
this.