r...@zedat.fu-berlin.de (Stefan Ram): > struct example > { PIC<5,X<15>> last_name; > PIC<88,VALUE<1,3,5,7,9>> odd_numbers; } > > . The above assumes appropriate definitions for »VALUE« (as a > variadic template) »PIC«, and »X«. Only a C++ expert would be able > to provide these definitions, but then they could be used by average > C++ programmers.
I don't like your expert/average dichotomy. Similar dichotomies plague other frameworks: Eclipse, Jenkins, Maven, Xt, MS Word etc. If templates are considered a good thing, creating them should be considered routine for *all* C++ programmers. > . C++ has a very expressive user-definable type system including > user-definable literals. I don't like said system. Analogously, I'm not too keen on formal schemata. Even more generally, I'm not big on *rule languages*, which are ad-hoc and incomplete. Instead, I prefer *programming languages*, which are compact and expressive, or even plain English. > It should then also be possible to generate compile-time errors for > assignments such as > > example_instance.odd_numbers = 4; Every programming language has its big selling points. C++'s gospel is its utmost compile-time checking. I'm a long time user of C++, but I'm not a convert to that ideology. > . I know too little about Python to tell whether something like this > would be possible with Python, too. Unfortunately, Python is taking baby steps in that direction. Marko -- https://mail.python.org/mailman/listinfo/python-list