Re: [fpc-pascal] All methods vitrual ?

2023-10-10 Thread Sven Barth via fpc-pascal
Adriaan van Os via fpc-pascal  schrieb am
Mi., 11. Okt. 2023, 06:25:

> Sven Barth via fpc-pascal wrote:
> > Am 10.10.2023 um 11:18 schrieb Adriaan van Os via fpc-pascal:
> >>
> >>>
> >>> - In the released compiler, if you remove all visibility specifiers,
> >>> you can
> >>>   get a list by specifying {$M+} on your base object and then list all
> >>>   published methods using the RTTI.
> >>
> >> My understanding is that I have to explicitely specify public for
> >> class fields, otherwise the compiler will issue an error.
> >
> > What exactly do you mean here? Do you have an example?
>
> {$mode macpas}
> {$M+}
> program testrtti;
> type
>T = object( TObject)
>  i: integer;
>  procedure A;
>end;
> procedure T.A;
>begin end;
> begin
> end.
>
> Free Pascal Compiler version 3.0.4 [2018/09/30] for x86_64
> Copyright (c) 1993-2017 by Florian Klaempfl and others
> Target OS: Darwin for x86_64
> Compiling testrtti.pas
> testrtti.pas(6,5) Error: Symbol cannot be published, can be only a class
> testrtti.pas(13) Fatal: There were 1 errors compiling module, stopping
>

Ah, yes, only classes and interfaces can be used for published fields. For
properties anything is allowed.

Regards,
Sven

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] All methods vitrual ?

2023-10-10 Thread Adriaan van Os via fpc-pascal

Sven Barth via fpc-pascal wrote:

Am 10.10.2023 um 11:18 schrieb Adriaan van Os via fpc-pascal:




- In the released compiler, if you remove all visibility specifiers, 
you can

  get a list by specifying {$M+} on your base object and then list all
  published methods using the RTTI.


My understanding is that I have to explicitely specify public for 
class fields, otherwise the compiler will issue an error.


What exactly do you mean here? Do you have an example?


{$mode macpas}
{$M+}
program testrtti;
type
  T = object( TObject)
i: integer;
procedure A;
  end;
procedure T.A;
  begin end;
begin
end.

Free Pascal Compiler version 3.0.4 [2018/09/30] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Darwin for x86_64
Compiling testrtti.pas
testrtti.pas(6,5) Error: Symbol cannot be published, can be only a class
testrtti.pas(13) Fatal: There were 1 errors compiling module, stopping

Regards,

Adriaan van Os

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] What is webasssembly?

2023-10-10 Thread Steve Litt via fpc-pascal
What is webasssembly?

SteveT

Steve Litt 

Autumn 2023 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] All methods vitrual ?

2023-10-10 Thread Sven Barth via fpc-pascal

Am 10.10.2023 um 11:18 schrieb Adriaan van Os via fpc-pascal:




- In the released compiler, if you remove all visibility specifiers, 
you can

  get a list by specifying {$M+} on your base object and then list all
  published methods using the RTTI.


My understanding is that I have to explicitely specify public for 
class fields, otherwise the compiler will issue an error.


What exactly do you mean here? Do you have an example?

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] All methods vitrual ?

2023-10-10 Thread Sven Barth via fpc-pascal

Am 10.10.2023 um 11:01 schrieb Adriaan van Os via fpc-pascal:

Sven Barth via fpc-pascal wrote:

No. Only those in the published section are part of the vMethodTable. 
And when compiled with $M+ the default visibility is changed from 
public to published. 


Also, I can get a list of the interfaces inherited from by a class, by 
looking at the vIntfTable of the VMT of the class. But is there also a 
way to get the method names from a CORBA interface ?


CORBA or raw interfaces don't have RTTI generation enabled. And even 
then the (COM) interfaces also need to have been parsed with $M enabled.


Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] All methods vitrual ?

2023-10-10 Thread Sven Barth via fpc-pascal

Am 10.10.2023 um 02:04 schrieb Adriaan van Os via fpc-pascal:

Sven Barth via fpc-pascal wrote:

No. Only those in the published section are part of the vMethodTable. 
And when compiled with $M+ the default visibility is changed from 
public to published. 


OK, but that means that by explicitely specifying 
public/private/protected for fields and published for methods, a 
method list can be generated when compiling with {$M+}.


Only for the class that is parsed while $M is enabled and all that 
inherit from that class. It does not affect any parent classes that 
don't have $M enabled.


Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] All methods vitrual ?

2023-10-10 Thread Adriaan van Os via fpc-pascal

Hairy Pixels via fpc-pascal wrote:



On Oct 10, 2023, at 4:18 PM, Adriaan van Os via fpc-pascal 
 wrote:

Interesting ! If I am correct, the docs referred to at 
 say

; visibility-clause:
; METHODS|PROPERTIES|FIELDS (visibility-expression)

Does that mean that the "extended RTTI" branch supports RTTI for fields ?


Yes, it should be compatible with Delphi so all fields with the specified 
visibility will be available at runtime.


Great !

Regards,

Adriaan van Os

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] All methods vitrual ?

2023-10-10 Thread Hairy Pixels via fpc-pascal


> On Oct 10, 2023, at 4:18 PM, Adriaan van Os via fpc-pascal 
>  wrote:
> 
> Interesting ! If I am correct, the docs referred to at 
>  say
> 
> ; visibility-clause:
> ; METHODS|PROPERTIES|FIELDS (visibility-expression)
> 
> Does that mean that the "extended RTTI" branch supports RTTI for fields ?

Yes, it should be compatible with Delphi so all fields with the specified 
visibility will be available at runtime.

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] All methods vitrual ?

2023-10-10 Thread Adriaan van Os via fpc-pascal

Michael Van Canneyt via fpc-pascal wrote:



On Mon, 9 Oct 2023, Adriaan van Os via fpc-pascal wrote:

Is there a trick to make (in mode macpas) all class methods 
implicitely virtual ? I mean, without adding the virtual keyword to 
all of them ? The reason is that I want to create a tree view of the 
class hierarchy with all the method names (not just those that are 
normally in the VMT because they are overridden).


Any other ideas ?


If you need this tree at run-time:

- The "extended RTTI" branch of fpc allows you to list all methods,
  regardless of their visibility


Interesting ! If I am correct, the docs referred to at 
 say


; visibility-clause:
; METHODS|PROPERTIES|FIELDS (visibility-expression)

Does that mean that the "extended RTTI" branch supports RTTI for fields ?



- In the released compiler, if you remove all visibility specifiers, you 
can

  get a list by specifying {$M+} on your base object and then list all
  published methods using the RTTI.


My understanding is that I have to explicitely specify public for class fields, otherwise the 
compiler will issue an error.




If you simply need this tree:

- You can simply use fcl-passrc to analyse your source tree and create 
the complete

  list. No changes to code needed. I have several programs that do this.


Will try that out, thanks.

Regards,

Adriaan van Os

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] All methods vitrual ?

2023-10-10 Thread Adriaan van Os via fpc-pascal

Sven Barth via fpc-pascal wrote:

No. Only those in the published section are part of the vMethodTable. 
And when compiled with $M+ the default visibility is changed from public 
to published. 


Also, I can get a list of the interfaces inherited from by a class, by looking at the vIntfTable of 
the VMT of the class. But is there also a way to get the method names from a CORBA interface ?


Regards,

Adriaan van Os

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] All methods vitrual ?

2023-10-10 Thread Michael Van Canneyt via fpc-pascal




On Mon, 9 Oct 2023, Adriaan van Os via fpc-pascal wrote:

Is there a trick to make (in mode macpas) all class methods implicitely 
virtual ? I mean, without adding the virtual keyword to all of them ? The 
reason is that I want to create a tree view of the class hierarchy with all 
the method names (not just those that are normally in the VMT because they 
are overridden).


Any other ideas ?


If you need this tree at run-time:

- The "extended RTTI" branch of fpc allows you to list all methods,
  regardless of their visibility

- In the released compiler, if you remove all visibility specifiers, you can
  get a list by specifying {$M+} on your base object and then list all
  published methods using the RTTI.

If you simply need this tree:

- You can simply use fcl-passrc to analyse your source tree and create the 
complete
  list. No changes to code needed. I have several programs that do this.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal