home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / fortran / 3340 < prev    next >
Encoding:
Text File  |  1992-09-01  |  3.0 KB  |  60 lines

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