[fpc-pascal] Question about interfaces
ml at brainwashers.org
Sun Mar 20 00:12:24 CET 2005
If you would at least read original message and responded to what I
asked or at least "not responded" maybe I wouldn't feel so stupid for
asking my question. But hopefully this will be the last message in this
Seems a bit sad to me that, I didn't get answer to "what I really asked"
but a lot of flaming posts about one btw. in my question, even subject
says "Question about interfaces" and not "Question about operators".
1. Couldn't interfaces support blind properties (specifying only read
write capability)? Without having to specify function and procedure for
writing. Property access varies from one interface inheritor to another
and interface cares only about read write ability of property. Blind
properties could be applied without any loosing of compatibility. And
demands a whole lot more code in the way as it is applied now.
What you would get from blind interface properties?
- Lot less code.
- Smaller more readable interfaces
- freedom of property implementation in classes
2. Question about operators was about YES: "existing" and YES: "pascal
standard" "is" operator and interfaces. Instead of needing to write
if Supports(obj, ISomeInterface) then
wouldn't it be nicer to be able to write
if (obj is ISomeInterface) then
if (obj is [ISomeInterface, ISomeOtherInterface]) then
Which is completely what you all said. I just noted that standard pascal
operator "is" does not exist for interfaces. Array checking would be
nice if one uses fine grained interfaces and therefore usually needs
more than one interface for one function
Other possibilities like ['?','%','$','|','&','::','^'] were only named
under btw. (and how can btw. under question 2 become the main flaming
topic is out of my reason, maybe its time to my annual lobotomy)
3. Interface multiple inheritance. Asking just for a reason why not, for
sole curiosity. I solved that for my self with macros. Thanks to Nikolay
at least I think I got that one answered (he responded with negative
reason enough). And I must say that as I read his answer, I started
finding the way to implement them, without bothering devel team. It is
doable, ugly but doable. Just as I implemented foreach().
What are benefits of interface multiple inheritance:
- No monolithic structure
- Fine grained interfaces (smaller, easier to read)
- Lot less code duplication
- Hierarchy is lot less monolithic
- Lot more power in functionality combinations and easier determination
On Sat, 2005-03-19 at 04:23 -0500, Bob Shaffer wrote:
> 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
I must say I don't really bother about, but what you said is plain
wrong, so I can't be quiet
That would be valid for community written projects only. So, no
proprietary software exists.
> 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.
Ever heard about documentation, and coding specifications being
associated with project.
> 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.
Already doing that. Don't worry.
p.s. Before you try to burn heretics, at least have a reason, not a
"quick doubt about heresy"
> 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
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
More information about the fpc-pascal