From: Sebastian K. <seb...@mu...> - 2003-06-25 19:26:42
|
Hi, On Monday 23 June 2003 16:37, Keats wrote: > You could still do this sort of thing with the $Template tool. People > didn't seem to like the template tool syntax, so I came up with the > directive approach which seems a bit more user friendly. > > My approach to the above would be to use a directive for the writer, say > #output ok, let's forget about the output thing. I only used this as an example. Like Brian, I personally do not think think it is necessary, but if Lane has a need for it, it's ok. My problem with the #eval-directive is of a more general nature: In WebMacro we basically have to possibilities to control the result of a template evaluation: 1) We can insert something into the output stream. This is usually done by a property reference $foo.bar 2) We can interact with the template engine and tell it to iterate certain blocks, chose one depending on a condition, set some properties and so on. Intuitively I think, that writing something into the output-stream (point 1) should be done via property references of the form $... and point 2 should be done via directives. Or to put it the other way round: I believe, that directives should not output anything by themselves. Of course the "#foreach" directive outputs a lot, but that comes from the block inside the directive, not from the directive itself. The same holds for "#if" and "#set" does not output anything at all. This is similar to the distinction between statements and expressions in most programming languages. I just realized, that this is how I thought about directives and property-refernces until now. In this picture a #templet directive would fit quite nice, because it just declares a template. However, for evaluating, I would find a $... syntax nicer. However, I must admit, that there exists directives (like those declared from macros), that do not fit in my own schema, so it is probably broken. But perhaps we can have some discussion about it: Do we have a consistent guideline, when to use $... syntax (via tools or macros) and when to use directives? I do not know of one and this is, where my confusion comes from. Sebastian -- Sebastian Kanthak PGP/GnuPG: http://www.muehlheim.de/~skanthak/pgp.html |