3 ms·
Does anyone have enough experience with Tk and REBOL why these should be exemplar as far as UI and layout is concerned?
by teyc 11y ago
Does anyone have enough experience with Tk and REBOL why these should be exemplar as far as UI and layout is concerned?
- DonHopkins 11y agoI implemented a gui for SimCity in Tk, and at the time (~1993) it was the best user interface toolkit for X11 available, but only because the competition was Motif and its ilk. The reason it was relatively good in that context is that it had a built-in scripting language: TCL. (So did WINTERP, but that was XLisp + Motif, so Motif made it suck a hell of a lot more than XLisp made it win.) As a scripting language, TCL is terribly designed (but beautifully implemented). But all that mattered at the time was that there was a scripting language that was present at the time the GUI tooklit, Tk, was designed (so they did not overlap and squabble about what they were trying to do) -- not that the scripting language itself was any good. (Personally, I'd MUCH rather be programming GUIs in PostScript than TCL, which is what I did before, for the previous port of SimCity to NeWS.) The fact that TCL was an integral part of the design of Tk from day 1 made it possible to use the scripting language for what it was good for, instead of Tk trying to do that in a half-assed non-turing-complete way: to glue everything together and do all the dynamic symbolic stuff, binding events to handlers, creating objects, naming them, plugging them together. All with wonderfully flexible simplicity and generality. Instead of trying to wrap the X Toolkit Intrinsic's and Motif's lame overlapping and incoherent attempts at object oriented programming, configuration, skinning and event handling in C and .XDefaults files. Here's a typical TCL file that creates an instance of a SimCity editor window (it's more complex than a typical less dynamic TCL gui, since it's capable of creating any number of independent editor window instances, which is why it uses a $win prefix for everything it creates): https://github.com/SimHacker/micropolis/blob/master/micropolis-activity/res/weditor.tcl https://github.com/SimHacker/micropolis/blob/master/micropol... No matter how much you love Lisp, WINTERP was still just using it to wrap Motif, even though Motif was suffering from a terminal case of Greenspun's tenth rule, and contained its own ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. Here's WINTERP: http://nielsmayer.com/winterp/ http://nielsmayer.com/winterp/
- knughit 11y agoThanks again for your incredible work on SimCity.
- draegtun 11y agoI've only had limited experience of Rebol View (VID & R3-GUI) so I don't feel qualified enough to give you a clear answer. However I can provide you with some HN comments that contain Rebol GUI code that I've posted here in the past: * https://news.ycombinator.com/item?id=7069311 https://news.ycombinator.com/item?id=7069311 * https://news.ycombinator.com/item?id=8624722 https://news.ycombinator.com/item?id=8624722 * https://news.ycombinator.com/item?id=9570049 https://news.ycombinator.com/item?id=9570049 NB. If you follow the thread up in the first link you'll find GUI comparisons with TCL & other languages. You may find more insight into the authors mind from snippets found in previous posts: http://prog21.dadgum.com/159.html http://prog21.dadgum.com/159.html - "The best attempt I've seen is the UI description sub-language of REBOL. Creating a basic window with labeled buttons is a one-liner. Clearly all wasn't perfect in REBOL-ville, as a burst of excitement in the late 1990s was tempered with a long period of inactivity, and some features of the language never quite lived up to their initial promises. These days HTML is the most reasonable approach to anything involving fonts and images and interaction. It's not as beautifully direct as REBOL, and being trapped in a browser is somewhere between limiting and annoying, but the visual toolkit is there, and it's ubiquitous. (For the record, I would have solved the "list all the filenames..." problem by generating HTML, but firing up a browser to display the result is a heavy-handed solution.)" http://prog21.dadgum.com/66.html http://prog21.dadgum.com/66.html - "A handful of language designers have tried to make GUI programming as easy as traditional programming. The Tk library for TCL, which is still the foundation for Python's out-of-the-box IDE, allows basic UI creation with simple, declarative statements. REBOL is a more recent incarnation of the same idea, that sample code involving windows and user input and graphics should be a handful of lines, not multiple pages of wxWindows fussing. I wish more people were working on such things."
- vitd 11y agoI was wondering the same thing. Reading the other answers, it seems like the reason the author thinks they're superior is that he can design interfaces using only code. (Not sure if that's the author's point or just the posters here.) I've had to use the apps that result from developers designing interfaces in code and I've had to read some of the code to do it, and in my experience it was all suboptimal. With a tool like Interface Builder (which I'm not saying is good), at least it gives you guides for the standard places that elements should line up with each other. Sometimes you want the baseline of the text of various elements to align. Sometimes you want to ensure the same padding around elements. All of that typically goes out the window when interfaces are designed via code, in my experience. Furthermore, the author seems to advocate that UIs should be disconnected from events. I can't think of a useful UI element that isn't tied to some event. I'd love to learn more about what they mean, but right now, it's not ringing true to me.
- draegtun 11y ago>> design interfaces using only code The lines are blurred in Rebol because code is data and data is code. >> the author seems to advocate that UIs should be disconnected from events I don't think the author is advocating this because both TCL/TK & Rebol View rely on events.