Could Python supplant Java?
Stuart D. Gathman
stuart at bmsi.com
Wed Aug 21 22:59:39 EDT 2002
On Thu, 22 Aug 2002, Delaney, Timothy wrote:
> > From: Stuart D. Gathman [mailto:stuart at bmsi.com]
> > This is exactly what Java interfaces do for you. If you declare a
> > variable as "FileLike", then any object, regardless of
> > derivation, can be
> > directly assigned to it provided it implements the FileLike interface.
> Yes .. which the File object does not. So you need to wrap it in a FileLike
If you had kept reading, I talk about this. And mention "signatures" as
a statically typed solution to this problem. The compiler creates
wrapper classes when needed for any object with the specified methods.
If you only care about a 'read' method, then specify your function arg/
variable is declared to take a signature with just a read method. Now
any object with a read method can be passed. The compiler will wrap it
first if needed. This will probably not get implemented in Java for
the same reason auto wrapping of int and friends to unify primitives and
classes is not implemented: the designers are concerned about the compiler
generating hidden code "under the covers" where embedded applications are
concerned. Never mind that embedded Java is currently a tiny part of its
market . . .
Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"[Microsoft] products are even less buggy than others, in terms of
per capita usage." - Steve Balmer, Microsoft Corporation
More information about the Python-list