-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generalise scalar-units defintions #145
Comments
I definitely think this is possible. For Puccini's implementation the minimal requirements for a definition are as follows:
|
As I've said before I think making the units string case insensitive is, in general, poor practice. Rather than having a parameter to indidate whether or not the units are case sensitive a user could define unit aliases if this was really needed, e.g.
|
I tend to agree, just showing that we could still support current behavior if necessary (which Puccini has to for 1.X parsing). |
I second Paul's proposal. |
Just pointing out that if you want to use aliases, then for 3-character units, e.g. KiB, you would need 2³=8 aliases, which is annoying to write out. Case insensitivity is easy enough to implement as a feature. But anyway I'm in favor of enforcing case sensitivity. Of course with user-defined units, users can do whatever they want. |
Here's a syntax suggestion:
and an example:
|
While the above syntax is relatively simple and probably adequate it does have some shortcomings:
|
Thanks @pmjordan. We'll make this a discussion topic for the Language Ad-Hoc once we finish substitution/requirement mappings. |
I concur that units should be case-sensitive. For time-units, TOSCA 1.3 only supports from nanoseconds So when we open up for custom extensions to the TOSCA 1.3 scalar units, we need to allow built-in units that do not follow the symbol-multiplier scheme. |
I implement these types using a multiplier table that translates the |
TOSCA is intended to be applicable to any domain but at present it only defines a few concrete scalar-units some of which are domain specific. We could add further scalar-units as demanded by users but this seems a slow and reactive approach.
Ideally we would allow users to define scalar-units useful to them e.g. in a similar manner to data type definitions. However, I can see that TOSCA processors would need a knowledge of the meaning of the unit strings (like the ‘m’, ‘m’ and ‘d’ symbols which we already allow to mean minute, hour and day as ‘s’ for seconds in scalar-unit.time).
An alternative would be to allow any scalar-unit from ISO 80000 since that covers many domains while using a fixed and defined set of prefixes (the familiar SI prefixes of ‘m’ milli, ‘M’ for Mega etc. and including KiB etc. for bytes). There are units libraries for common languages which can handle such unit strings. ISO 80000 must be paid for but a non-normative public document is at
https://www.bipm.org/documents/20126/41483022/SI-Brochure-9.pdf
The text was updated successfully, but these errors were encountered: