On 24/01/13 14:22, Robert Dewar wrote:
On 1/24/2013 9:10 AM, Alec Teal wrote:

Alec I am eager to see what you guys think, this is a 'feature' I've
wanted for a long time and you all seem approachable rather than the
distant compiler gods I expected.

I certainly see the point of this proposal, indeed introducing
this kind of strong typing makes sense to anyone familiar with
Ada, where it is a standard feature of the language, and the
way that Ada is always used.
I came up with this because of my job, I create stuff for Android devices this means I have to use Java - I HATE JAVA! It's crap for SO MANY reasons. Anyway the stuff I do must be high performance, it's for games (not all can be done native and it's preferable to use Java where you can because of the massive wadge of different devices). Lack of structs became a big problem and OpenGL has a lot of flags, using hard-typing would mean the IDE could only hint at ones that made sense (rather than the general int), same with using SQLite on Android, I don't want to create a Java class because I know what I'm doing and that's overkill, the class will actually exist! Just to wrap an int, this would allow me to create an int but not be allowed to mis-use it, it'd also let me overload stuff based on the type, even when it's an int right down.

It isn't really a feature in the sense of a new syntax, it's just the word "hard" and the result is this no-runtime-overhead-but-otherwise-the-same case where you can overload too!

However, I wonder whether it is simply too big a feature for
gcc to add on its own to C++. For sure you would have to have
language lawyers look very carefully at this proposal to see
if it is indeed sound with respect to the formal rules of the
language. Often features that make good sense when expressed
informally turn out to be problematic when they are fully
defined in the appropriate language of the standard.
I agree sadly, even if "hard" was a pre-processor macro that 'became' hard when GCC was compiling (using a simple #ifdef) and it became a "normal" typedef, all that lovely overloading and purpose would be gone.

I can also see why 'strong typedefs' were not done, it tries to do
too much with the type system and becomes very object like....

I don't see what this has to do with objects!

That's because this has nothing to do with objects, in the paper that was linked (called "strong typing") it implemented new types rather like objects, "using score = public int { //definitions }; for example, "extending an int" effectively, this is what I mean by a PHP-noob going class-mad.

Reply via email to