alternatives to keyword parameters (was: Re: [Developers] Double quotes around keyword parameter values)

Erik Schnetter schnetter at aei.mpg.de
Sun May 29 12:23:47 CDT 2005


On Sunday 29 May 2005 17:47, Jonathan Thornburg wrote:
> Ok, what about your scheme, call them "identifier parameters":

This is close to what I had in mind, except that I would not introduce a 
new parameter type, but make it possible to do the same with keyword 
parameters.  That is, after a param.ccl declaration

KEYWORD commute_method "how should I commute to work?"
{
	work_at_home    :: "real geeks have DSL and work at home"
	walk            :: "low-tech but works fine"
	S_bahn          :: "not that cheap, but works well"
	bicycle         :: "works great if you're in decent health"
	car             :: "useful for speeding up global warming"
	1+log           :: "ouch -- not a C identifier"
} walk

you say in your code

DECLARE_CCTK_PARAMETERS;
DECLARE_CCTK_PARAMETER_KEYWORD_MACROS_onlymakethisshorter;

and then go on with

if (commute_method == work_at_home) {
	/* ... */
}

etc.

The badly designed keyword "1+log" is then either not translated into a 
macro, or the macro is "cleaned", such that it turns into something 
like M1_log.  (If we want to go overboard, we can also add a choice for 
the macro to the keyword value specification.)

The advantage of this scheme is that new code can use this new scheme 
with the existing keyword declarations.  When we introduce identifier 
parameters, we have two equally bad choices: either leave the existing 
keyword parameters as they are and do not use the new feature, or 
change existing thorns and all other thorns that depend on them and 
which we might not even know.

-erik

-- 
Erik Schnetter <schnetter at aei.mpg.de>   http://www.aei.mpg.de/~eschnett/

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from www.keyserver.net.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.cactuscode.org/pipermail/developers/attachments/20050529/442bd1a5/attachment-0002.bin 


More information about the Developers mailing list