hard typdef - proposal - I know it's not in the standard
Alec Teal
a.teal@warwick.ac.uk
Thu Jan 24 19:23:00 GMT 2013
On 24/01/13 18:45, Jonathan Wakely wrote:
> On 24 January 2013 16:21, Alec Teal wrote:
>> 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.
> I think you've misunderstood the proposal. The syntax you refer to
> defines a strong typedef for int and defines an overloaded operator
> for it, it doesn't go class-mad and has nothing to do with PHP or
> "everything is a class". It would add no overhead over an int either,
> if implemented sensibly, it would only have compile-time properties
> and not alter runtime behaviour. Reel in the hyperbole.
>
....What? No.
In PHP when people learn about objects they tend to make EVERYTHING into
an object and never use inheritance. I'm playing on that! In the paper
they define X Y and Z components, EVERYTHING is a defined type of sorts.
When it comes to runtime overhead, yes there is none in both cases, but
it's about look, the one in the document looks like a class, it makes
sense to be but it's a bulky syntax for something as small as a typedef.
I'm not saying "not" the above, just that it invites overuse - I do have
an extension to the idea that employs more of the abstract algebra
that'd look a lot like what that paper is on about, anyway, I propose
something simple, not different, small and not able to be over-used
without real stupidity taking over (probably)
See what I mean? Again not saying 1 or the other, just that with this,
then the strong ones.
More information about the Gcc
mailing list