home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!usc!cs.utexas.edu!hellgate.utah.edu!lanl!cochiti.lanl.gov!jlg
- From: jlg@cochiti.lanl.gov (Jim Giles)
- Subject: Re: Scientists as Programmers (was Re: Smal
- Message-ID: <1992Sep1.175255.6697@newshost.lanl.gov>
- Sender: news@newshost.lanl.gov
- Organization: Los Alamos National Laboratory
- References: <1992Aug30.232409.15262@nrao.edu> <1992Aug31.163405.2169@newshost.lanl.gov> <1992Aug31.164354.3518@newshost.lanl.gov> <BtwK17.ADM@mentor.cc.purdue.edu>
- Date: Tue, 1 Sep 1992 17:52:55 GMT
- Lines: 48
-
- In article <BtwK17.ADM@mentor.cc.purdue.edu>, hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
- |> In article <1992Aug31.164354.3518@newshost.lanl.gov> jlg@cochiti.lanl.gov (Jim Giles) writes:
- |> [...]
- |> >No one is recommending (and Herman didn't) that strict typing be abandoned.
- |> >It is possible to have type coercion and *still* be able to statically
- |> >determine type. [...]
-
- |> [...]
- |> I did mean that the user should be able, when appropriate, to completely
- |> ignore the type. This should be a deliberate act, however, by one who
- |> knows what is being done.
-
- The problem with trying to completely ignore the type is that without
- type there are *no* operations defined on an object. What you really
- need is the ability to coerce type without actually altering the bits
- of the data. That way, you can take operations (like shift, mask, booleans,
- integer arithmetic, etc.) which are defined on one type in your language
- and use them on another type. Without any type at all, not even assignment
- is defined on the data object.
-
- Languages like Modula have a data type called `word' which has a certain
- minimal set of operations defined on it. This is *NOT* a mechanism for
- completely ignoring type, it is a subset of the mapping mechanism I
- proposed. The notation I advocate allows *any* type to be mapped to
- *any* other type - giving the user complete flexibility over what
- operations are desired to be carried out. You can even map things
- to a data type called `word' which has the same set of operations
- defined on it that Modula `word' type posesses.
-
- All languages which allow the user to "completely ignore the type" are
- really just casting the object to a specific type that they simply
- *call* "typeless", but which has specific operations and properties
- defined for it, just like all the other types in the language.
-
- |> [...]
- |> The above example shows some of the problems. The multiplication above
- |> will work provided there is no overflow and x(5) != 0. If the leading
- |> bit of normalized numbers is present, it will also work if x(5) = 0, but
- |> dividing by 2 by subtracting one from the exponent will not work.
-
- Obviously!! I was giving an example of *notation*, not of how to do
- specific operations on floating point. As I pointed out, this stuff
- is _always_ machine dependent and requires care. It can be seen that
- the notation I described makes it *possible* to manipulate the floating
- point numbers in the high-level language.
-
- --
- J. Giles
-