[fpc-other] FPC Hypocrisy: overloaded L505
L
L at z505.com
Tue Feb 26 20:59:37 CET 2008
Florian Klaempfl wrote:
> > Skybuck Flying schrieb:
> > For records, I would use an extension field like:
> >
> > IP.Payload
> >
> > and
> >
> > UDP.Payload
> >
> > I would hardly call that obfuscation :)
>
> Having the same name for different things is always obfuscation.
Pascal programmers are Hypocrites. :-)
{$mode objfpc}
procedure test;
procedure test(i: integer);
procedure test(s: string);
// oh shit, a STRING? Shortstring? or ANSISTRING!!
Let's see now.. we don't even mark the test() procedures as OVERLOAD
since OBJFPC mode doesn't even require it.
The STRING declaration.. can mean a million things..
shortstring, ansistring, uhm.. maybe in the future LONGSTRING.
What is a string again? Dunno, was {$H+} put before or AFTER the mode
switch? Depending on where you put it, you might get different results.
The Test() procedures are not even obviously marked as overloaded..
Who KNOWS which test() procedure we are calling.
Add an ARRAY of CONST paramm to the Test procedure.. and it makes it all
even more confusing since Test() can do MANY things
procedure test(array of const);
test(500); // I am calling which one?
Maybe only this calls the array of const one:
test([500]);
But not sure! Because it COULD be a human mistake made to think that:
test(500) calls the array of const one.. but maybe it doesnt.
What else do we have to discuss today in this fine email?
Freepascal supports operator overloaders. Operators that mean the same
thing.
Uh.. what does the plus sign mean again? Oh... that's right... it means
whatever you want it to mean.
Then there is the.. uhm.. Object Orientation bit...
What does an abstracted class do again? Dunno, bunch of overriden or
overloaded or inherited stuff that says something the same, but does
something completely different than the other class.
Oh, then there is the ancient turbo pascal "Global Namespace".
uses
someunit, someunit2, sysutils;
begin
format() // uh.. not sure what this is calling
// could be..
// someunit.format()
// or
// someunit2.format()
// or maybe even
// system.format(); // if that even existed
// or.. maybe it was from sysutils
// sysutils.format()
// whatever was in the Uses clause first, I guess
end.
Then what other hacks are people doing with freepascal?
fpExec
fpSomeFunction
fpBlah
Because we can't have those functions mean the same thing as Exec()
somewhere else? Or because we lack proper modules in modern pascal?
fp.blah
fp.SomeFunction
Well folks, my brain is overloaded. Back to coding!
--
L505
(with a grain of salt please)
More information about the fpc-other
mailing list