[fpc-pascal] Question about interfaces

Bob Shaffer freepascal at bobshaffer.net
Sat Mar 19 10:23:46 CET 2005


I think I'm going to have to agree with everyone else on this one.  If I
read this, thinking it was pascal code, I wouldn't have the slightest idea
what these % and/or $ operators were doing.  Operator overloading should
never be used to change the meaning of an operator.  It's there so you can
make existing operators work with abstract datatypes.  If you save a few
minutes coding things with operators that only have meaning to you, nobody
else can understand what it does without a lot of extra work.

If you really want to add things like this to the language, I think that
the free pascal compiler's source code is all included, written (mostly)
in pascal itself, and I've heard that it's self-compilable, so you already
have all the tools to develop your own extended pascal language.

ml said:
> On Sat, 2005-03-19 at 01:40 +0200, Nikolay Nikolov wrote:
>> ml wrote:
>>
>> >btw. When writing about operators, why do they contain such little
>> >possibilities. operator overloads could contain possibility for
>> >['?','%','$','|','&','::','^']
>> >
>> >
>> These are C++ operators, aren't they?
>
> Yes (some of them are, but not all), but if you think about it basic
> definition of operators is to make source code more easily readable.
>
> Couldn't you imagine to use
> a := b % c;
> and a would actually contain real percentage??
>
> or
> s := 'Value is : ' $ CurrentValue;
>
> and this would translate CurrentValue to currency and add to a string?
>
> btw. and yes,:) my line of work forces me to use pascal, c#, c++, c,
> sql, shell and a little bit of php. So I'm forced to see the beauty and
> the ugly parts and features of each one. And operators are a real life
> saver, at least for future reading of your code (that is if they are
> carefully designed).
>
> ml
>




More information about the fpc-pascal mailing list