On Sunday, July 8, 2001, at 09:34  AM, Aleksei Guzev wrote:

> Why not to define a numeric types representing "procents" or "promiles".

That can easily be done using tie() (assuming you talk about Perl) and
attributes as an easier interface. The following attribute and underlying
class has yet to be written, but isn't very complicated:

	my $foo : Percent;

> And what about types for meters, miles, feets etc. Automatic convertion
> while assignment whould be useful. But language should support constants
> of that type. Maybe use letters after digits: 10mm, 15cm, 5,8miles,
> 4.45kg, 35%.
>
> Raising exceptions on trying to add some kilograms to some miles would
> protect user of a lot of algorithmical mistakes.

AFAIK, Damian Conway has such a module in the making:

	use Data::Units;
	my $weight : Unit(kg) = 20;

or something like this. Exception raising can be achieved using that
as well.

(I'm not sure whether Damian is not this list; I've just joined it
myself.)

Marcel

--
Marcel Grunauer          | $ perl -we time
Codewerk Perl Services   | Useless use of time in void context at -e 
line 1.
http://www.codewerk.com  |
Perl 6 proof-of-concepts |