[fpc-pascal] FPImage and GetDataLineStart
Michael Van Canneyt
michael at freepascal.org
Fri Apr 22 19:05:30 CEST 2011
On Fri, 22 Apr 2011, Florian Klämpfl wrote:
> Am 22.04.2011 14:01, schrieb michael.vancanneyt at wisa.be:
>>
>> By this rule, the helper class/operator/beast you proposed in the other
>> mail
>> should also not be available, because it is not known during definition.
>>
>> Just as a helper is 'attached' to a type, an operator is equally
>> 'attached' to the type. Both can be "attached" by a third party that
>> requires it : all that is needed to use it is that it is in your current
>> scope.
>
> IMO a helper is bound closer to a type than an operator.
Please explain ? To my understanding, they're on exactly the same level ?
(from a language feature point of view).
I mean, what can be more close to a type than a := operator ?
>> To me this means that if you allow the one, you should - logically -
>> allow the other.
>> (or vice versa)
>
> With the same reasoning, one should allow also functions taking the type
> as parameter.
Functions are different, because they are not something you attach to a type.
A function just happens to have one parameter (out of possibly many) of a
particular type.
A class helper and operator are explicitly designed for this type, enhancing it
to be able to work with it.
But that's beside the point:
I just think that if you except one and the other not, then that does not
look like a very consequent application of generics, more like patchwork
instead of a well integrated language feature.
I see no reason why you would prefer one language feature above another
in such cases.
Michael.
More information about the fpc-pascal
mailing list