[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 81-lang-extensions.patch
From: |
Akim Demaille |
Subject: |
Re: 81-lang-extensions.patch |
Date: |
23 Mar 2001 18:07:00 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley) |
| Hi,
| Akim Demaille <address@hidden> writes:
| > + while (my ($attr, $value) = each %option)
| > {
| [snip]
| > + if ($attr eq 'ansi')
| > {
| > + $lang_obj->ansi ($value);
| > }
| > + elsif ($attr eq 'autodep')
| > {
| > + $lang_obj->autodep ($value);
| > }
| > + elsif ($attr eq 'compile')
| > + {
| > + $lang_obj->compile ($value);
| > + }
| [snip]
|
| Wouldn't this be more compact and readable without the loop?
|
| $lang_obj->ansi ($options{'ansi'}) if exists $options{'ansi'};
| $lang_obj->autodep ($options{'autodep'}) if exists $options{'autodep'};
| $lang_obj->compile ($options{'compile'}) if exists $options{'compile'};
| # ...
|
| delete $options{$_} for (('ansi', 'autodep', 'compile', ...));
| complain(...) if (keys %options);
Oh yes, definitely! Thanks!
But in fact, this code is made to be killed soon: recent versions of
Class::Struct finally (aah!) provide a `new' which accepts a hash to
initialize the object. We won't need this code, and probably we would
need register_language either, just calls to `new'.