08-10-2011, 03:02 AM,
(This post was last modified: 08-10-2011, 05:12 AM by RobertShiplett.)
|
|||||
|
|||||
Curl macros introduction (part 1)
This series is about Curl macros
Macros allow you to create both very simple and very complex results in Curl web pages, in Curl applications, and in Curl scripts. Most often they hide complexity from the user of the macro and keep markup simple. You use a macro in Curl just as you would use any other Curl expression. Examples: are any macros? Suppose We Wrote:{paragraph This is a text procedure } Default Curl expressions (from the Curl library packages) which begin with {define- are macros. The Curl documentation clearly indicates which expression prefixes are macros both in the index and the respective macro pages. The live-code in the docs in built using the {example } macro. Expressions with arguments not separated by commas or separated by other characters would be macros (but I suggest using commas in your macros and in what follows I try to show why.) A macro is used to define new macros: it is {define-macro } and it gets its power from two other macros, those being {syntax-switch } and {expand-template }. A macro call is replaced by the source code corresponding to the value which the macro returns (although macros do not declare a return value, they use {return } expressions. In a package write: Code: {define-macro public {uc ?txt:text} In an applet write: Code: {import uc from MY.MACROS} In the browser we see Curl Wrote:THIS QUOTED TEXT WILL PRINT IN CAPS WITHOUT THE QUOTES Note: Curl is an expression-based language, but macros may identify some expressions as statements. Examples are let and set expressions which were not surrounded by curly-braces for your convenience or other expressions where curl-braces were not required. Macro pattern case logic can recognize MyClass.myClassProc as a BinaryOp. But we will set all these details to one side for now.
Robert Shiplett, Curlr
Fredericton NB Canada |
|||||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Curl macros introduction (part 1) - by RobertShiplett - 08-10-2011, 03:02 AM
RE: Curl macros introduction (part 1) - by RobertShiplett - 08-10-2011, 05:42 AM
RE: Curl macros introduction (part 1) - by RobertShiplett - 08-10-2011, 05:57 AM
RE: Curl macros introduction (part 1) - by RobertShiplett - 08-10-2011, 06:04 AM
RE: Curl macros introduction (part 1) - by glennmcgrath - 04-25-2015, 05:28 PM
|
Users browsing this thread:
1 Guest(s)
1 Guest(s)