1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
'''News'''
0.1 version released. This is the first real release in form of a Tcl package.
See the download section for the download URL.
'''Introduction'''
[Sugar] is a macro system for the Tcl programming language, with a design
very similar to [Lisp] macros.
This document will try to explain what [Sugar] macros are, how they
can be applied, and why I think they improve the Tcl language.
Every time I refer to the term [macro] in this document, I mean
a [Sugar] Tcl macro if not better specified.
Note that the idea of a macro system for Tcl is not new, but as far
as I know, there is no implementation that is comparable with
[Sugar] in terms of usage and design principles.
Something of similar in the spirit, is the [Tmac - a Tcl macro processor package],
but it works by pattern matching and substitution, requires the user to use
a special syntax, does not guarantee the expansion
to happen only where actually a command can be called, and can't
be used to add arbitrary new syntax to Tcl (syntax macros feature
of [Sugar]), nor complex code transformation (see for example the transformer
macro to optimize tail calls in this document).
'''Programmer API'''
The following sections will explain the basic [Sugar] API with
some detail, but it's worth to say now that macro expansion happens
when the [proc] command is called. Actually [Sugar] is a wrapper for
proc, an API to write source code transformations, and some command
to register this transformations in the modified version of [proc].
'''Sections'''
* Section 0 - '''[Sugar]''' (what you are reading)
* Section 1 - '''[Sugar command macros]'''
* Section 2 - '''[Sugar syntax macros]'''
* Section 3 - '''[Sugar transformers]'''
You may also want to check the [Sugar macros collection] page.
'''Authors'''
I'm ([Salvatore Sanfilippo]) currently the only author of [Sugar].
'''Download'''
You can get the latest version of [Sugar] from
http://www.hping.org/tclsbignum/sugar-0.1.tar.gz
If you have suggestions, bugfixes or API changes requests,
please drop me an email at antirez at invece dot org.
See also [run].
'''Disambiguation'''
http://www.sugarcrm.com/crm/%|%SUGAR%|% is also an open source CRM (Customer Relationship Management) application.
<<categories>> Application | Dev. Tools | String Processing
|