On Mon, 2005-03-28 at 16:00, Larry Wall wrote: > I've always thought that we should make use of the database of the > "units" program for standardized names of units. The units database > has a pretty good list of which units are just differently scaled > units of the actual underlying fundamental dimensions, and a lot > of encoded experience in distinguishing ambiguous units names. It'd > be a shame to reinvent all that.
That makes fine sense, and I think it would be fairly trivial to generate a set of roles from the Units database at run-time, pre-compiled with the source or both (selectable in some way). Of course, there are going to be people who have to re-define chunks of that namespace because they have special needs (e.g. money -- this is such a huge bear of a problem that it can only be solved for the domain-specific cases), but that's fine, and does not preclude your suggestion. here's a start: perl -nle 'while(<>) {print("# $_"),next if /^\s*($|\#)/;$c="";s/\s+\#.*// && ($c=$&);($unit,$def)=split /\s+/, $_, 2;if ($def eq "!") {$base{$unit}=1;print "class units::$unit does unit { ... }$c"} elsif ($unit =~ /-$/){print "# No handling for prefixes yet ($unit=$def)$c"}elsif($base{$def}){print "class units::$unit is units::$def;$c"}else{print "# No handling for derived units yet ($unit=$def)$c"}}' < /usr/share/units.dat -- Aaron Sherman <[EMAIL PROTECTED]> Senior Systems Engineer and Toolsmith "It's the sound of a satellite saying, 'get me down!'" -Shriekback