Post Reply 
newRPL: [UPDATED April 27-2017] Firmware for testing available for download
10-22-2015, 09:43 PM
Post: #82
RE: newRPL: [UPDATED Oct-19-2015] Firmware for testing available for download
(10-22-2015 08:50 PM)matthiaspaul Wrote:  Actually, I think, prefixes are so fundamental, the system should ideally support them both (decimal per SI/ISO and binary per IEC/IEEE/ISO) by default.
I understand your point.
Decimal prefixes are used for many units, consistently as per SI specifications, therefore it makes sense that the system supports them automatically, as the effort of entering 20 units for each unit you want to define is significant.
Binary prefixes on the other hand, are only used on one unit (byte). For that one particular case, there's only a few units that need to be defined (8), so I'm not sure I can justify the speed penalty in the system to scan for those prefixes on every single operation involving units.
Other than the definition of the unit, there's absolutely no difference on whether the prefix is applied "manually" by the user, or automatically by the system, so in that case I'll probably define the byte with all its prefixes as a system unit, with 8 individual definitions, and the user will never know the difference.

(10-22-2015 08:50 PM)matthiaspaul Wrote:  For flexibility, perhaps the ? syntax could be expanded by adding some kind of "attributes" to it so that the system will support on a unit by unit basis:

- no unit prefixes (f.e. 'u' UDEFINE)
- all decimal and binary prefixes (f.e. '?u' UDEFINE)
- only decimal prefixes (f.e. 'x?u' UDEFINE)
- only binary prefixes (f.e. 'i?u' UDEFINE)
- only decimal prefixes with positive exponents (f.e. '+?u' UDEFINE or '+x?u' UDEFINE)
- only decimal prefixes with negative exponents (f.e. '-?u' UDEFINE or '-x?u' UDEFINE)
- decimal with positive exponents only as well as binary prefixes (f.e. '+i?u' UDEFINE or '+xi?u' UDEFINE)

Ideas for other special case attributes:

- allow percent and permille as unit prefixes (f.e. '%?u' UDEFINE)
- absolute / relative unit conversion as with temperatures (would need some additional notation to specify conversion factors)
- allow to specify a "preferred" target prefix to be used in results (would need some system to resolve conflicting preferences for different units). The system would still allow to convert into something specific, but would default to preferred units otherwise (f.e. 'm?m' UDEFINE would return results in mm, even if given in cm or m etc. or 'Gi+x?B' UDEFINE would return results in GiB even if given in GB, whereas 'G+xi?B' UDEFINE would return results in GB even if given in GiB.)

(The syntax is just a rough proposal to illustrate the idea, nothing "finished".)


I like the "preferred target unit" idea, perhaps as an attribute of a variable, not of the unit per se. I'm not so sure how to implement something like that yet, I'll have to give it some more thought.
Regarding the additional syntax, 'G+xi?B' looks like a Regex expression, a user would only be able to use that with the manual in hand, or more likely will never use that feature.
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: newRPL: [UPDATED Oct-19-2015] Firmware for testing available for download - Claudio L. - 10-22-2015 09:43 PM

User(s) browsing this thread: 1 Guest(s)