PT 20-Jul-2004
The LOAF protocol is another computer communications protocol. LOAF is characterized by its ease of implementation and the simplicity of its wire protocol. There are implementations is a large number of languages for diverse platforms. See http://postneo.com/postwiki/moin.cgi/LoafHome for additional information and standards track.
Here is a pure-Tcl implementation.
# LOAF.tcl - Copyright (C) 2004 Pat Thoyts <[email protected]> # # Pure Tcl implementation of the LOAF protocol # See http://postneo.com/postwiki/moin.cgi/LoafHome for further details. # # ------------------------------------------------------------------------- # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # ------------------------------------------------------------------------- # namespace eval ::LOAF { variable version 0.1.0 variable rcsid {$Id: 11994,v 1.13 2006-05-25 18:00:10 jcw Exp $} namespace export LOAF } # ------------------------------------------------------------------------- # LOAF::LOAF # The core LOAF protocol function. This drives everything. # Returns: # A normal Tcl result. # proc ::LOAF::LOAF {args} { return } # ------------------------------------------------------------------------- package provide LOAF $::LOAF::version # ------------------------------------------------------------------------- # Local variables: # mode: tcl # indent-tabs-mode: nil # End:
NEM: Have you considered submitting this to tcllib?
PT: Absolutely - continuing the practice of adding support for as many protocols as possible to tcllib. However, before this is to happen it will need a test suite and some interoperability testing against implementations in other languages. Especially against implementations on alternative architectures.
I also plan to add some critcl support to provide a speed up to any areas that profile as processing hot-spots.
Stefan Vogel LOAF is so cool. I've written a whitepaper about LOAF. For more information, see [L1 ].
ZLM Stefan, your whitepaper is very clear and succinct. Could you please provide a PDF version for easy printing?
Stefan Vogel Thanks for your interest. A german PDF-version can be downloaded from [L2 ].
US Great stuff! Unfortunately it lacks extensibility. Most of my projects would benefit from LOAF, if I could add some code to it. That's why I implemented ::LOAF::MEAT, The "Management of Extensions to Avoid Trouble". Yes, I admit you have to pay a performance penalty, but it's a fair price for the almost unlimited extensibility you get.
proc ::LOAF::LOAF {args} { catch "::LOAF::MEAT $args" return } proc ::LOAF::MEAT {args} { # load all packages you need/want/find foreach pkg {list of packages} { package require $pkg } # do your work call my_procs }
RS You get more efficient bytecode with the following implementation:
proc LOAF::LOAF args {}
Ro Why would you care? Since when are we so concerned about efficiency in an HLL? Not the sort of thing my mind should be concerned about.