Path: news.daimi.aau.dk!jlk From: jlk@daimi.aau.dk (J|rgen Lindskov Knudsen) Newsgroups: comp.lang.beta Subject: Re: BETA and X-Windows (was: Re: LISP and X-Windows) Date: 12 Sep 1994 12:54:07 GMT Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 110 Message-ID: <351j1f$m6e@belfort.daimi.aau.dk> References: <34pog5$lss@hpsystem1.informatik.tu-muenchen.de> <34t9k3$2g5@nz12.rz.uni-karlsruhe.de> Reply-To: jlknudsen@daimi.aau.dk (Jorgen Lindskov Knudsen) NNTP-Posting-Host: lithium.daimi.aau.dk Keywords: beta, lisp, clim, clx, ew, clio, clue, garnet In <34t9k3$2g5@nz12.rz.uni-karlsruhe.de> Thus spake haible@ma2s2.mathematik.uni-karlsruhe.de (Bruno Haible): > ... >When I contrast this situation in Lisp and C to the tiny X11 Hello-World >program for Beta: >ORIGIN '~beta/Xt/v1.8/awenv'; >(* The traditional "Hello World" program, > * here made by the use of a Label widget > *) >--- PROGRAM: descriptor --- >AwEnv >(# hello: @Label; >do hello.init; > 'Hello World' -> hello.label >#) >I can only keep wondering: How do you get Hello-World programs that small? >Are Mjolner's libraries especially "designed" for Hello-World programs? >Is it clever use of inheritance and "initialization methods"? (Please >forgive me the Lisp terminology.) ............................................................................... No, the Mjolner libraries are not especially "designed" for Hello-World programs :-) The catch is the strengths of the BETA language in enabling the design of frameworks (e.g. the X libraries) which takes care of (most of) the tedious initialization and setup code, that needs to be written for other libraries. To illustrate, here is another example, implementing a full-fledged texteditor, with menus and file loading (based on Athena Widgets): ORIGIN '~beta/Xt/v1.8/awenv'; INCLUDE '~beta/basiclib/v1.4/file'; -- PROGRAM: descriptor -- (* A more advanced example of using AsciiText. This is a small text editor * with support for loading, editing, and saving files. This example also * shows the use of translations: Here they are used to make within * the filename button cause the loading of the file. *) awenv (# Main: @Form (# dirty: @boolean; Bell: (# do ascii.bel -> put #); DoLoad: @RegisteredAction (# theFile: @File; do (if dirty // true then Bell else (* load new file *) filename.string -> theFile.name; (if theFile.entry.exists // false then theFile.touch if); theFile.name -> Buffer.string; if);#); Filename: @AsciiText (# init ::< (# trans: @TranslationTable; do 'Return: DoLoad()' -> trans.parse -> overridetranslations; edit -> editType; true -> resize; true -> resizable; 'Untitled' -> string; #)#); ShapedCommand: Command (# init::< (# do oval -> shapeStyle; INNER #)#); Quit: @ShapedCommand (# callback::< (# do (if dirty // true then Bell else Stop if) #)#); Load: @ShapedCommand (# callback::< (# do DoLoad #)#); Save: @ShapedCommand (# callback::< (# do Buffer.save; false-> dirty #)#); Buffer: @AsciiText (# callback::< (# do true -> dirty #); init::< (# do scrollAlways -> scrollVertical; scrollWhenNeeded -> scrollHorizontal; edit -> editType; 200 -> width; true -> resize; ChainTop -> top; asciiFile -> type; #)#); init::< (# do DoLoad.install; Quit.init; Quit[] -> fixChildSize; Filename.init; Filename[] -> fixChildSize; Quit -> filename.fromVert; Load.init; Load[] -> fixChildSize; Quit -> Load.fromVert; Filename -> Load.fromHoriz; Save.init; Save[] -> fixChildSize; Quit -> Save.fromVert; Load -> Save.fromHoriz; Buffer.init; Load -> Buffer.fromVert; #); #); do Main.init; #) -- Jorgen Lindskov Knudsen, Computer Science Department, Aarhus University Ny Munkegade 116, DK-8000 Aarhus C, DENMARK E-mail: jlknudsen@daimi.aau.dk, Phone: +45 89 42 32 33, Fax: +45 89 42 32 55