[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]
pseudo constructors in smalltalk
- To: <dean>, <markm>
- Subject: pseudo constructors in smalltalk
- From: Hugh Hoover <heh>
- Date: Sat, 10 Feb 90 17:13:04 PST
- Cc: <ravi>, <xtech>
This issue needs to be resolved immediately.
The preferred smalltalk form is Classname make, which translates to
Unfortunately, private classes cannot have a make class method and
translate correctly. The pseudo constructor is created with a return type
of the class, not the superclass, which is not correct. We could translate
the make differently if we know the class is private (not too hard) but we
can't always be sure the superclass is the correct return type. It would
be possible to search up the class tree to the first public class and use
that as the return type. This would be correct in most cases.
The other alternative is the older method, where a subClassname method
is added in the appropriate class (return type class).
An easy solution is to forbid PrivateClass make in all code. This works
except for some cases like OrderSpec, Ascending / Descending, where we would
like Ascending and Descending to be private, but still be able to create them
with the standard make rather than OrderSpec ascending. This, of course,
breaks our use-of-private-class checker in smalltalk.