Board index » delphi » Coupla D2005 bugs/incompatibilities

Coupla D2005 bugs/incompatibilities


2005-01-15 07:28:13 AM
delphi272
I noticed them in fido7.ru.delphi
a) Delphi 7 compiles "packed object" ok, D2005 refuses.
b) code below
type
TClass1 = class
class function Get_Property1: String;
property Property1: String read Get_Property1;
end;
D7 compiles, D2005 - oops again.
 
 

Re:Coupla D2005 bugs/incompatibilities

Andrew Rybenkov writes:
Quote
I noticed them in fido7.ru.delphi

a) Delphi 7 compiles "packed object" ok, D2005 refuses.
b) code below

type
TClass1 = class
class function Get_Property1: String;
property Property1: String read Get_Property1;
end;

D7 compiles, D2005 - oops again.

This is actually 'works as designed'. In Delphi 7 it would compile, but not really work correctly. Can't
remember the exact problem i got into with this.
 

Re:Coupla D2005 bugs/incompatibilities

Andrew Rybenkov writes:
Quote
a) Delphi 7 compiles "packed object" ok, D2005 refuses.
I guess they want to get rid of "object" altogether, so that is no
surprise.
Quote
type
TClass1 = class
class function Get_Property1: String;
property Property1: String read Get_Property1;
end;

D7 compiles, D2005 - oops again.
This should not compile. So the bug appears to be in D7.
--
Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de
"I agree with the reforms, but I want nothing to change"
-- Ion Luca Caragiale, Romanian playwriter, 1880
 

Re:Coupla D2005 bugs/incompatibilities

Rudy Velthuis [TeamB] writes:
Quote
>type
>TClass1 = class
>class function Get_Property1: String;
>property Property1: String read Get_Property1;
>end;
>
>D7 compiles, D2005 - oops again.

This should not compile. So the bug appears to be in D7.
I don't know why it shouldn't compile.
Anyway, the workaround is to do...
type
TClass1 = class
class function Get_Property1: String;
function _Get_Property1 : string;
property Property1 : string read _Get_Property1;
end;
...
function TClass1._Get_Property1 : string;
begin
result := Get_Property1
end;
--
Colin - Author of XanaNews
 

Re:Coupla D2005 bugs/incompatibilities

Colin Wilson writes:
Quote
Rudy Velthuis [TeamB] writes:

>>type
>>TClass1 = class
>>class function Get_Property1: String;
>>property Property1: String read Get_Property1;
>>end;
>>
>>D7 compiles, D2005 - oops again.
>
>This should not compile. So the bug appears to be in D7.

I don't know why it shouldn't compile.
Because Property1 is not a class property. Only class properties can
have class functions as getter.
--
Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de
"I'm not a member of any organized political party, I am a Democrat!"
-- Will Rogers (1879-1935)
 

Re:Coupla D2005 bugs/incompatibilities

Rudy Velthuis [TeamB] writes:
Quote
>I don't know why it shouldn't compile.

Because Property1 is not a class property. Only class properties can
have class functions as getter.
No - that is the wrong way round(!)
Class properties can only have class functions as getters. They can't
have regular functions as getters, because there's no 'instance'.
But non class properties can (should be able to) have either non-class
or class functions as getters. When the non class property is called,
there's an instance - so either should work.
--
Colin - Author of XanaNews
 

Re:Coupla D2005 bugs/incompatibilities

Colin Wilson writes:
Quote
Rudy Velthuis [TeamB] writes:

>>I don't know why it shouldn't compile.
>
>Because Property1 is not a class property. Only class properties can
>have class functions as getter.

No - that is the wrong way round(!)
No, it is also valid that way around.
--
Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de
"Do illiterate people get the full effect of alphabet soup?"
-- John Mendoza
 

Re:Coupla D2005 bugs/incompatibilities

Rudy Velthuis [TeamB] writes:
Quote
No, it is also valid that way around.
No it is not. There's no technical reason why a non-class property
can't have a class method as a getter.
If you can think of one, please let us know!
--
Colin - Author of XanaNews
 

Re:Coupla D2005 bugs/incompatibilities

Martin Waldenburg writes:
Quote
In D4 properties could have have a class method as a getter.
I've used this extensively in my OpenToolsApi classes, very
convinient. Unfortunately this was broken with D5, which anooyed me
very much.
Given all the recent talk, sure its not just a bug in delphi 4 which
allows you to do this?
 

Re:Coupla D2005 bugs/incompatibilities

Colin Wilson writes:
Quote
There's no technical reason why a non-class property
can't have a class method as a getter.
In D4 properties could have have a class method as a getter.
I've used this extensively in my OpenToolsApi classes, very convinient.
Unfortunately this was broken with D5, which anooyed me very much.
Martin
 

Re:Coupla D2005 bugs/incompatibilities

Liz writes:
Quote
Martin Waldenburg writes:

>In D4 properties could have have a class method as a getter.
>I've used this extensively in my OpenToolsApi classes, very
>convinient. Unfortunately this was broken with D5, which anooyed me
>very much.

Given all the recent talk, sure its not just a bug in delphi 4 which
allows you to do this?
Its allowed in D5, Delphi 6 & D7, too. Haven't tried it in D8.
There may have been a bug in it in D4 (maybe other versions too), but I
can't think of any technical reason why it shouldn't be allowed.
It looks like that Borland maybe thought "there's a bug in this. Let's
just disable it - instead of fixing it". Maybe they did that for the
Active Form and Active X control wizards, too.
Symptomatic of the 'new Borland', or just one of those things. You
decide ;)
--
Colin - Author of XanaNews
 

Re:Coupla D2005 bugs/incompatibilities

Colin Wilson writes:
Quote
>>convinient. Unfortunately this was broken with D5, which anooyed
>>me very much.
>
>Given all the recent talk, sure its not just a bug in delphi 4 which
>allows you to do this?

Its allowed in D5, Delphi 6 & D7, too. Haven't tried it in D8.
Oh ok, its just he said it broke in d5.. so I kinda got the impression
it was d4 only.
Quote
It looks like that Borland maybe thought "there's a bug in this.
Let's just disable it - instead of fixing it". Maybe they did that
for the Active Form and Active X control wizards, too.
No worse than a microsoft fix..
MS: "Hey, your outlook file is corrupt.. I shall fix it.."
You: Dir <your outlook file>
PC: <your outlook file>0 bytes
:)
 

Re:Coupla D2005 bugs/incompatibilities

Liz writes:
Quote
Oh ok, its just he said it broke in d5.. so I kinda got the impression
it was d4 only.
In D4 it worked without to create an instance,
you had just to declare a variable once and then you
could use it from everywhere without ever to call create().
Martin
 

Re:Coupla D2005 bugs/incompatibilities

Martin Waldenburg writes:
Quote
In D4 it worked without to create an instance,
you had just to declare a variable once and then you
could use it from everywhere without ever to call create().
Ah
Ive seen mixed versions of both, and have had unclear messages about
creating and not needing to create things.