home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / windows / x / 14407 < prev    next >
Encoding:
Text File  |  1992-07-26  |  2.1 KB  |  57 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!wupost!sdd.hp.com!think.com!redsox!campbell
  3. From: campbell@redsox.bsw.com (Larry Campbell)
  4. Subject: Re: X: User simplicity vs code complexity (vs language limitations)
  5. Message-ID: <1992Jul26.221924.29209@redsox.bsw.com>
  6. Sender: campbell@redsox.bsw.com (Larry Campbell)
  7. Organization: The Boston Software Works, Inc.
  8. References:  <1992Jul24.145008.1028@ERA.COM>
  9. Date: Sun, 26 Jul 1992 22:19:24 GMT
  10. Lines: 45
  11.  
  12.  
  13. In article <1992Jul24.145008.1028@ERA.COM>, feit@ERA.COM (Mark Feit) writes:
  14. > Yes, and there are reasons for things like that.  Those two particular
  15. > functions serve different purposes, and a thorough reading of the
  16. > manual pages for both will reveal that.  The reason for most of the
  17. > other function pairs (i.e., XDrawLine/XDrawLines) is to keep traffic
  18. > between the client and server to a minimum.  The former is for those
  19. > cases where you only need ONE.
  20.  
  21. Although I agree with your overall point, this particular example
  22. (XDrawLine(s)) doesn't support it.  That these are two routines, rather
  23. than one, is due to limitations in the programming language (C) rather
  24. than a necessary optimization of network traffic.
  25.  
  26. Omitting constant arguments for clarity, in Lisp (Scheme) you could say
  27. something like this:
  28.  
  29.     (x:draw-lines (big-computation))    ; draw complex figure
  30.  
  31. just as easily as
  32.  
  33.     (x:draw-lines '((x1 . y1) (x2 . y2)))    ; draw single line
  34.  
  35. There's no need for a separate "x:draw-line" routine.  C programmers
  36. want to have such a routine because an XDrawLines that can accept
  37. a dynamically computed (potentially large) list of points:
  38.  
  39.     big_computation(&pointer_to_list, &length_of_list);
  40.     XDrawLines(pointer_to_list, length_of_list)
  41.  
  42. becomes cumbersome if you want to just draw a single line:
  43.  
  44.     XPoint points[2];
  45.     points[0].x = x1;
  46.     points[0].y = y1;
  47.     points[1].x = x2;
  48.     points[1].y = y2;
  49.     XDrawPoints(points, 2);
  50.  
  51. But this is a problem with C, not a problem with X, and there are
  52. many such examples.
  53. -- 
  54. Larry Campbell             The Boston Software Works, Inc., 120 Fulton Street
  55. campbell@redsox.bsw.com    Boston, Massachusetts 02109 (USA)
  56.