[LINK] REAL Basic language for Win, Mac and Linux

Jonathon Padfield jpadfield at hotkey.net.au
Fri Jun 17 13:58:31 EST 2005


On Friday 17 June 2005 13:32, Rick Welykochy wrote:
> WARNING: techno-babble ahead!
>
> 2. Containers only hold base class objects; up-casting is required to
>     extract, say, a Person object from a list. This is plain wrong. And
>     it is often called the 'goto' of data. Run-time excpetions anyone?
>     Other lanugages do not have this problem AFAIK, although O-O Pascal
>     can be messy in this regard as well.

This has been fixed in Java 5 (1.5). 
You can declare a HashMap or Vector as containing a specific set of data.
Eg,
private HashMap<String, Integer> daysInMonth = new HashMap<String, Integer)();

You can even use the 'for' statement in a similar manner to perl's foreach.

for (String key: daysInMonth.keySet()) { ... }

I would argue that Interfaces are a bad substitute for properly managed 
Multiple Inheritance though. Eiffel does it better on that score.

-Jon


More information about the Link mailing list