I wonder whether it would be possible to make these special "one of
several" macros look a little more like the regular syntax. After all,
it's basically just an OR-op that the caller can hook into to specify
which alternative to choose.
Consider the case when there's just a simple alternative between two
modules, Email::Foo and Email::Bar. In the current proposal, it would
require three macros:
def foo = Email::Foo
def bar = Email::Bar
def foo_or_bar := [ :foo :bar ]
When really, we might rather it looked like a real OR-op:
choice foo_or_bar = Email::Foo (foo) || Email::Bar (bar)
For the more complicated cases, one might still prefer a macro for each
piece, in which case the 'name' of each alternative could default to
the name of the macro:
def mysql = DBD::mysql && DateTime::Format::mysql
def pg = DBD::pg && DateTime::Format::pg
choice db = {mysql} || {pg}
# the above is shorthand for: choice db = {mysql} (mysql) || {pg}
(pg)
-Ken
On Oct 16, 2004, at 4:42 AM, Randy W. Sims wrote:
Yeah, that still applies. It will have to be implemented differently
since we're using straight expressions. Right now, the best approach I
can think of is to allow two types of macros to be created.
1. A simple macro that can be substituded into the tree.
eg. def mysql = DBD::mysql && DateTime::Format::mysql
2. A special macro that represents a set of alternative options.
eg. def db := [ :mysql :pg ]
Option 2 would enable commandline options of the form: --use-mysql &&
--use-pg (or similar)
or something like that. I'm not sure I really like it. It's much more
complicated to implement this way.
A complete expression might look something like:
requires => q[
def mysql = DBD::mysql && DateTime::Format::mysql
def pg = DBD::pg && DateTime::Format::pg
def db := [ :mysql :pg ]
DateTime && {db} && Other::Stuff
];
Details subject to change...
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
|