Graphics at Inferno

    If you write distributed applications in the style of file servers, then you will encounter graphics in Inferno no sooner than you want to run a graphical debugger to debug your multi-threaded application.

    But if you are writing an application with a UI that should work on embedded devices or as a plug-in in a browser (by the way, they’re developing an analogue of the existing Inferno plug-in for IE under Firefox, by the way), the question immediately arises: “How to write graphical applications in Inferno?” .


    The only way to work with graphics in Inferno is with Tk. Moreover, Tk support is built into the core (!) Inferno. Of course, for programming a graphical UI, Tk probably can’t be anything easier (I don’t take Delphi-style UI designers now, because although they are easy and convenient to use, the code that they generate is an order of magnitude more complicated than the Tk code).

    On Limbo / Tk in Inferno, absolutely all graphical applications are written including the wm window system itself (an analog of X-Window).

    But personally, the look of Tk applications always upset me and I could never understand why no one would do support for styles / skins for Tk. :( Update: actually there is support for styles, just no one has drawn alternative styles yet.

    Unfortunately, I can’t add anything else on this issue, because I didn’t work with graphics in Inferno - it’s more interesting for me to write distributed applications and file servers.


    Another interesting mechanism in Inferno and Plan9 is Plumbing. In principle, it can be used in text mode, but it is mainly used when working in wm.

    This mechanism provides the ability to transfer messages between applications, and the user can control this process through the config file of the plumber service. For example, when you click on a file in the file manager, it simply passes the name of this file to plumber and that launches the application corresponding to this file. Or during drag-n-drop, when you drag an object from one application to the window of another application, the first simply sends a message through the plumber to the second indicating which object to transfer.

    Here is an example of the plumber config, for clarity:
    # file URLs go to wm/charon
    kind is text
    data matches '[a-zA-Z0-9_/\-]+\.html?'
    data isfile $0
    data set file://localhost$file
    plumb to web
    plumb start /dis/charon.dis $data
    # .m files are looked up in /module and passed to wm/brutus
    kind is text
    data matches '([a-zA-Z0-9]+\.m)(:[0-9]+)?'
    data isfile     /module/$1
    data set        /module/$0
    plumb to edit
    plumb start /dis/wm/brutus.dis $file$2

    Unfortunately, I didn’t really work with him either ... people who worked with Plan9 will probably be able to tell more about plumbing. Feel free to post on this blog, it is collective ...

    I just decided it was better to mention these things at least that way. Then again I will write about the things with which I worked. :)

    Also popular now: