Tue, 25 Jul 2000 10:16:24 +0100, Chris Angus <[EMAIL PROTECTED]> pisze:

> eg. readDyn could have the signature
> 
> String -> Dynamic

It's not possible. Which types are "registered" to be read that way?
What if types have conflicting printed representations?

> around this area I'd be more interested in requesting values by
> name/type rather than discovering the type of an "untyped" object.

Name in which namespace? What if several modules export values and
types of the same name? What if the implementation introduces the
concept of a package, allowing reusing a module name in different
packages?

Those dynamic interfaces assume that there exists a database of all
possible types. But I treat types as a potentially infinite family,
without concrete names. Names are for writing source code, they are
subject to lexical scoping and don't exist at runtime. Each new type
is unique. The compiler statically checks which types are the same,
but it does not allow enumerating all types. Also private types used in
a module are not visible anywhere else, unless the module exports them.

I accept hacks to get constructor names for convenient generation of
Read and Show instances, or Dynamic which allows to temporarily put
a value in a fixed type and then take it back. But both are hacks,
they exist only because they are convenient and we don't know better
solutions - they are *not* elegant, they don't fit the spirit of a
statically typed language with lexical scoping.

Names are context dependent. Objects themselves nor their types don't
have names. The source uses some names to refer to objects from a
particular place, but there exists neither a universal mapping from
names to objects nor a universal mapping in the opposite direction.
Renaming in import lists no longer exists, but it shows that names
are arbitrary and local.

-- 
 __("<  Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/            GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-


Reply via email to