🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.language.delphi.dotnet
9 messages
9 total messages Started by VT Venkatesh Sat, 26 Jul 2008 08:43
What is the meaning of E2355
#163
Author: VT Venkatesh
Date: Sat, 26 Jul 2008 08:43
32 lines
2198 bytes
I am getting the following error
E2355: Class property accessor must be a class field or class static method

I am getting the error in
class property FilesTypesToSearch: string read    get_FilesTypesToSearch;
in the class declaration given below
venkatesh
***************************************************
Site = class
   strict private
   class var
     m_ApplicationPath: string;
   public
     constructor Create;
     class function get_FilesTypesToSearch: string;
     class function get_DynamicFilesTypesToSearch: string;
     class function get_BarredFolders: string;
     class function get_BarredFiles: string;
     class function get_EnglishLanguage: Boolean;
     class function get_ApplicationPath: string;
     procedure set_ApplicationPath(Value: string);
     class property FilesTypesToSearch: string read 
get_FilesTypesToSearch;
     class property DynamicFilesTypesToSearch: string read 
get_DynamicFilesTypesToSearch;
     class property BarredFolders: string read get_BarredFolders;
     class property BarredFiles: string read get_BarredFiles;
     class property EnglishLanguage: Boolean read get_EnglishLanguage;
     class property ApplicationPath: string read get_ApplicationPath 
write set_ApplicationPath;
   end;
************************************************************8
Re: What is the meaning of E2355
#164
Author: Robert Giesecke
Date: Sat, 26 Jul 2008 11:02
16 lines
1540 bytes
VT Venkatesh wrote:
> I am getting the following error
> E2355: Class property accessor must be a class field or class static method
> 
> I am getting the error in
> class property FilesTypesToSearch: string read    get_FilesTypesToSearch;
> in the class declaration given below
> venkatesh
....
>     constructor Create;
>     class function get_FilesTypesToSearch: string;
 >

That's one of these Win32-lookalike things that is biting you here.
You have to mark a class method as "static" to have a normal CLR static method.
Otherwise D.Net will emit a hidden parameter that takes the metaclass...
Re: What is the meaning of E2355
#165
Author: VT Venkatesh
Date: Sat, 26 Jul 2008 12:24
13 lines
1370 bytes
Robert Giesecke wrote:

>  >
> 
> That's one of these Win32-lookalike things that is biting you here.
> You have to mark a class method as "static" to have a normal CLR static 
> method.
> Otherwise D.Net will emit a hidden parameter that takes the metaclass...

When i try I get the error
[DCC Error] uSite.pas(19): E2376 STATIC can only be used on non-virtual 
class methods
Venkatesh
Re: What is the meaning of E2355
#167
Author: Robert Giesecke
Date: Sat, 26 Jul 2008 15:52
24 lines
2090 bytes
VT Venkatesh wrote:
> Robert Giesecke wrote:
> 
>>  >
>>
>> That's one of these Win32-lookalike things that is biting you here.
>> You have to mark a class method as "static" to have a normal CLR 
>> static method.
>> Otherwise D.Net will emit a hidden parameter that takes the metaclass...
> 
> When i try I get the error
> [DCC Error] uSite.pas(19): E2376 STATIC can only be used on non-virtual 
> class methods
> Venkatesh
> 

Well, of course. Even though D.Net tries very hard to hide a lot of what makes up .Net from you, in 
the end it still has to follow its rules.
.Net has no notion of metaclasses, and the way they are impleemnte in d.Net reuire them to be passed 
as a parameter to non-static class methods.
You cannot use "self" inside a static method, you cannot call non-static class methods as well. As I 
said, non-static class methods require the meta class to be passed as a hidden parameter.
Static methods are stateless, and therefor they have no metaclass reference to pass to other class 
methods. Hence not being able to call them.
Re: What is the meaning of E2355
#170
Author: Lionel
Date: Sat, 26 Jul 2008 17:38
42 lines
2623 bytes
May be it is because Delphi doesnt like get_ and set_

I  have this problem with Delphi 6 : try getFilesTypesToSearch instead of 
get_FilesTypesToSearch

Lionel


"VT Venkatesh" <venks@vsnl.com> a �crit dans le message de news: 
488ae28d@newsgroups.borland.com...
>I am getting the following error
> E2355: Class property accessor must be a class field or class static 
> method
>
> I am getting the error in
> class property FilesTypesToSearch: string read    get_FilesTypesToSearch;
> in the class declaration given below
> venkatesh
> ***************************************************
> Site = class
>   strict private
>   class var
>     m_ApplicationPath: string;
>   public
>     constructor Create;
>     class function get_FilesTypesToSearch: string;
>     class function get_DynamicFilesTypesToSearch: string;
>     class function get_BarredFolders: string;
>     class function get_BarredFiles: string;
>     class function get_EnglishLanguage: Boolean;
>     class function get_ApplicationPath: string;
>     procedure set_ApplicationPath(Value: string);
>     class property FilesTypesToSearch: string read get_FilesTypesToSearch;
>     class property DynamicFilesTypesToSearch: string read 
> get_DynamicFilesTypesToSearch;
>     class property BarredFolders: string read get_BarredFolders;
>     class property BarredFiles: string read get_BarredFiles;
>     class property EnglishLanguage: Boolean read get_EnglishLanguage;
>     class property ApplicationPath: string read get_ApplicationPath write 
> set_ApplicationPath;
>   end;
> ************************************************************8 
Re: What is the meaning of E2355
#173
Author: Robert Giesecke
Date: Sun, 27 Jul 2008 19:45
13 lines
1582 bytes
Lionel wrote:
> May be it is because Delphi doesnt like get_ and set_
> 
> I  have this problem with Delphi 6 : try getFilesTypesToSearch instead of 
> get_FilesTypesToSearch
> 

I don't think that this should be a problem in Delphi6, but it could be one in Delphi.Net.
In .Net, a property XYZ consists of nothing more than the methods get_XYZ and set_XYZ. (both with the 
specialname flag)
It could very well be the case, that D.Net can't handle it when the setter/getter have these names.
So you might have to remove the underscores.
I haven't touched D.Net for too many years, so it could be that it can handle this situation now.
Re: What is the meaning of E2355
#174
Author: John Moshakis
Date: Sun, 27 Jul 2008 20:16
29 lines
1705 bytes
VT Venkatesh wrote:

> I am getting the following error
> E2355: Class property accessor must be a class field or class static
> method

Hi Venkatesh,

I think you need to add static to the end of all the getters and setters

    class function get_FilesTypesToSearch: string;static;
    class function get_DynamicFilesTypesToSearch: string;static;
    class function get_BarredFolders: string;static;
    class function get_BarredFiles: string;static;
    class function get_EnglishLanguage: Boolean;static;
    class function get_ApplicationPath: string; static;

    class procedure set_ApplicationPath(Value: string);static;

Access to the class var in the getter and setter would be like this

  result:=Site.m_ApplicationPath;

Cheers,
John


-- 
Blog: http://blog.moshine.com/
Re: What is the meaning of E2355
#175
Author: John Moshakis
Date: Sun, 27 Jul 2008 20:24
39 lines
1555 bytes
Lionel wrote:

> May be it is because Delphi doesnt like get_ and set_
> 
> I  have this problem with Delphi 6 : try getFilesTypesToSearch
> instead of get_FilesTypesToSearch
> 

Hi Lionel,

If you don't use the get_ and set_ pattern Delphi.Net will generate
them for you

ie

    property SomeProperty:string read FSomeProperty write FSomeProperty;

If you open up reflector you will see these methods. You can also call
them yourself

  instance.set_SomeProperty('John');

Or you can do it yourself

    procedure set_SomeProperty(Value:string);
    function get_SomeProperty():string;
  published

    property SomeProperty:string read get_SomeProperty write
set_SomeProperty;

Cheers,
John




-- 
Blog: http://blog.moshine.com/
Re: What is the meaning of E2355
#176
Author: Lionel
Date: Mon, 28 Jul 2008 07:45
58 lines
3123 bytes
Sorry, i meant Delphi BDS 2006, not Delphi 6

under Delphi BDS 2006 do not use get_ nor set_ or you will get errors.

so, under Delphi BDS 2006 : write getFilesTypesToSearch instead of
get_FilesTypesToSearch

i guess the same problem will occur on Delphi 2007.

Lionel

"Lionel" <Lionel.rault@atscan.fr> a �crit dans le message de news: 
488b614c@newsgroups.borland.com...
> May be it is because Delphi doesnt like get_ and set_
>
> I  have this problem with Delphi 6 : try getFilesTypesToSearch instead of 
> get_FilesTypesToSearch
>
> Lionel
>
>
> "VT Venkatesh" <venks@vsnl.com> a �crit dans le message de news: 
> 488ae28d@newsgroups.borland.com...
>>I am getting the following error
>> E2355: Class property accessor must be a class field or class static 
>> method
>>
>> I am getting the error in
>> class property FilesTypesToSearch: string read    get_FilesTypesToSearch;
>> in the class declaration given below
>> venkatesh
>> ***************************************************
>> Site = class
>>   strict private
>>   class var
>>     m_ApplicationPath: string;
>>   public
>>     constructor Create;
>>     class function get_FilesTypesToSearch: string;
>>     class function get_DynamicFilesTypesToSearch: string;
>>     class function get_BarredFolders: string;
>>     class function get_BarredFiles: string;
>>     class function get_EnglishLanguage: Boolean;
>>     class function get_ApplicationPath: string;
>>     procedure set_ApplicationPath(Value: string);
>>     class property FilesTypesToSearch: string read 
>> get_FilesTypesToSearch;
>>     class property DynamicFilesTypesToSearch: string read 
>> get_DynamicFilesTypesToSearch;
>>     class property BarredFolders: string read get_BarredFolders;
>>     class property BarredFiles: string read get_BarredFiles;
>>     class property EnglishLanguage: Boolean read get_EnglishLanguage;
>>     class property ApplicationPath: string read get_ApplicationPath write 
>> set_ApplicationPath;
>>   end;
>> ************************************************************8
>
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads