IFC TYPEs
Do you know any programming language that supports these types?
Data types:
- Primitive
- TYPE name = BOOLEAN;
- TYPE name = BINARY;
- TYPE name = LOGICAL;
- TYPE name = INTEGER, {1 <= SELF <= 7};
- TYPE name = REAL, {0.0 <= SELF <= 1.0};
- TYPE name = NUMBER, SELF IN ['value1', 'value2', ...];
- Composite
- TYPE name = SET [number : ?] OF type/entity;
- TYPE name = ARRAY [number : number] OF type/entity;
- TYPE name = LIST [number : number] OF type/entity;
- TYPE name = SELECT(value1,value2,...);
- TYPE name = ENUMERATION OF (value1,value2,...);
- TYPE name = STRING;
- TYPE name = STRING(number);
- TYPE name = STRING(number) FIXED;
- TYPE name = type, SELF IN ['value1', 'value2', ...];
- TYPE name = type, {1 <= SELF <= 7};
CC: Thomas @aothms, Stephen @stephen_l, Dion @Moult?
Comments
For instance, arrays have this pattern:
In C++
In Python
So, I'm looking for a schema and/or language that supports this:
I think pretty much every language out there can handle what you've listed. Languages typically let you define your own data and / or object structures.
Your third example I guess in Python may be
ages = range(0, 121)
.@Moult I mean types can have range?
And some similar notions I shared at the first comment from IFC EXPRESS?
@ReD_CoDE sure it can.
@Moult yes, but I don't talk about that kind
I talk about types that natively support ranges and some similar notions, and as far as I know for instance Haskell somewhat support them
Those types have a specific name
What I've shown is how programming languages work. A "native" type is always defined somewhere.
Algebraic data types. Haskell indeed is one of the relatively few languages that support them nicely. But you can sort of trivially program constraints for values in any programming language. This article discusses such types nicely and uses Javascript for examples: https://jrsinclair.com/articles/2019/algebraic-data-types-what-i-wish-someone-had-explained-about-functional-programming/
One of the Javascript 'types' is simply:
So you could easily put any validation there, for example min & max for range or whatever.
To conclude that article notes:
Python provide "compile time" type checking using type hints (pep 484)
Hi Stephen @stephen_l, I think @antont and you, and even Dion mentioned closely
I'm looking for a programming language, but mainly a schema (file format), that supports validation and deduplication and dependent types