home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / perl / 7001 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  2.3 KB

  1. Path: sparky!uunet!ukma!wupost!usc!news!netlabs!lwall
  2. From: lwall@netlabs.com (Larry Wall)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: Questions on Perl Source Code.
  5. Message-ID: <1992Nov16.191456.21565@netlabs.com>
  6. Date: 16 Nov 92 19:14:56 GMT
  7. References: <5444@daily-planet.concordia.ca> <5445@daily-planet.concordia.ca>
  8. Sender: news@netlabs.com
  9. Organization: NetLabs, Inc.
  10. Lines: 50
  11. Nntp-Posting-Host: scalpel.netlabs.com
  12.  
  13. In article <5445@daily-planet.concordia.ca> marcap@cs.concordia.ca (PAWLOWSKY marc) writes:
  14. : Due to a nasty gotch'a in the 80486 my port of PERL has trouble
  15. : with integers.  In particular 1 becomes 1.000000000000000056.
  16.  
  17. I'd say your sprintf is badly busted...
  18.  
  19. : Now this little beast cause trouble on unformatted outputs, and
  20. : when lists are joined, and even trouble with boolean operators.
  21.  
  22. Certainly.
  23.  
  24. : Now the question is can anybody tell me where are doubles converted
  25. : to strings (is it in sprintf statements allover?)
  26.  
  27. Only one place matters for your purposes.  Look for sprintf() in str.c.
  28.  
  29. : Can anybody
  30. : tell mhere are the logical operators implemented (e.g. ||, &&, ...).
  31.  
  32. Those are in eval.c, but I don't think you'll need to touch them.
  33.  
  34. : Is there a document somewhere that helps explan the C source code.
  35. : I'm looking for some type of overview, explaining what the data 
  36. : structures are, flow control, tht type of thing.
  37.  
  38. An internals document?  Yikes.  If I did that, Perl would now be 582
  39. languages instead of one language.
  40.  
  41. Besides, it'd all be obsolete now anyway.  Perl 5 doesn't even have
  42. str.c or eval.c!  I recommend that you not spend too much time cozying
  43. up to my old code, unless perhaps you're a psychologist, or need one.
  44.  
  45. : Thanks
  46.  
  47. You're welcome.
  48.  
  49. : P.S.  Hint for next version of PERL, include an integer type
  50. : that is freely converted between doubles, strings, and integers
  51. : so this type of portability problem disappears.
  52.  
  53. The ideal in a language like Perl is that scalars always look like
  54. strings to the casual observer, with numeric optimizations occurring
  55. internally.  Though it doesn't currently, Perl 5's compiler could
  56. easily analyze return types and arguments to see where integers can be
  57. substituted for doubles.  Perl 4's compiler simply can't do this,
  58. because it needlessly defers too many decisions to run-time.  It's
  59. one of the reasons I completely scrapped the old compiler.
  60.  
  61. Larry
  62.