home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!wupost!sdd.hp.com!think.com!redsox!campbell
- From: campbell@redsox.bsw.com (Larry Campbell)
- Subject: Re: X: User simplicity vs code complexity (vs language limitations)
- Message-ID: <1992Jul26.221924.29209@redsox.bsw.com>
- Sender: campbell@redsox.bsw.com (Larry Campbell)
- Organization: The Boston Software Works, Inc.
- References: <1992Jul24.145008.1028@ERA.COM>
- Date: Sun, 26 Jul 1992 22:19:24 GMT
- Lines: 45
-
-
- In article <1992Jul24.145008.1028@ERA.COM>, feit@ERA.COM (Mark Feit) writes:
- >
- > Yes, and there are reasons for things like that. Those two particular
- > functions serve different purposes, and a thorough reading of the
- > manual pages for both will reveal that. The reason for most of the
- > other function pairs (i.e., XDrawLine/XDrawLines) is to keep traffic
- > between the client and server to a minimum. The former is for those
- > cases where you only need ONE.
-
- Although I agree with your overall point, this particular example
- (XDrawLine(s)) doesn't support it. That these are two routines, rather
- than one, is due to limitations in the programming language (C) rather
- than a necessary optimization of network traffic.
-
- Omitting constant arguments for clarity, in Lisp (Scheme) you could say
- something like this:
-
- (x:draw-lines (big-computation)) ; draw complex figure
-
- just as easily as
-
- (x:draw-lines '((x1 . y1) (x2 . y2))) ; draw single line
-
- There's no need for a separate "x:draw-line" routine. C programmers
- want to have such a routine because an XDrawLines that can accept
- a dynamically computed (potentially large) list of points:
-
- big_computation(&pointer_to_list, &length_of_list);
- XDrawLines(pointer_to_list, length_of_list)
-
- becomes cumbersome if you want to just draw a single line:
-
- XPoint points[2];
- points[0].x = x1;
- points[0].y = y1;
- points[1].x = x2;
- points[1].y = y2;
- XDrawPoints(points, 2);
-
- But this is a problem with C, not a problem with X, and there are
- many such examples.
- --
- Larry Campbell The Boston Software Works, Inc., 120 Fulton Street
- campbell@redsox.bsw.com Boston, Massachusetts 02109 (USA)
-