View Issue Details

IDProjectCategoryView StatusLast Update
0000707LDMudImplementationpublic2021-04-16 22:26
Reportersinnvoll Assigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionwon't fix 
Summary0000707: unit types
DescriptionI propose an extension for the type system.
An characterstring stored additional to the standardtypes.
The new types could inherit the standardtypes operations.
They would have an cast to its standardtype.

The interesting part would be the type-check.
1 meter != 1 second // -> true
set_duration(1 meter); // -> error

That given mapping and array could be parameterized:
3dpoint[30 x][40 y][50 z]
This should produce errors when twisting indices.

Syntax:
unittype meter int;
unittype second int;

int a=1;
meter x= meter(a);
meter y= meter(15);

printf("%d",to_int(x+y));
TagsNo tags attached.
External Data (URL)

Activities

zesstra

2009-12-17 04:34

administrator   ~0001652

I think, this concept is a bit too high-level for the LPC language itself.
Especially, when it comes to complex units (like W), you basically need to program a lot of rules for unit conversions. And it is anyway not sufficient to hard-wire these rules, because anybody is free to name units or devise new units as he or she wants...

Gnomi

2021-04-16 22:26

manager   ~0002619

We think that is too complex to be handled on the LPC language level.
Therefore closing this ticket.

Issue History

Date Modified Username Field Change
2009-12-11 19:08 sinnvoll New Issue
2009-12-17 04:34 zesstra Note Added: 0001652
2021-04-16 22:26 Gnomi Status new => closed
2021-04-16 22:26 Gnomi Resolution open => won't fix
2021-04-16 22:26 Gnomi Note Added: 0002619