Re: [fpc-pascal] with in classes/records

2018-09-09 Thread Ryan Joseph
It seems syntacticly possible that default properties could be recursive by 
having a default property reference a record/class with another default 
property. Should that be allowed?

type
THelperB = record
field: integer;
end;

type
THelperA = record
obj: THelperB;
property helperB: THelperB read obj write obj; default;
end;


type
TWrapper = record
obj: THelperA;
property helperA: THelperA read obj write obj; default;
end;


var
wrapper: TWrapper;
begin
wrapper.field := 100;   // wrapper.helperA.helperB.field := 100

Regards,
Ryan Joseph

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

Re: [fpc-pascal] with in classes/records

2018-09-09 Thread Martin

On 09/09/2018 10:48, Ryan Joseph wrote:

It seems syntacticly possible that default properties could be recursive by 
having a default property reference a record/class with another default 
property. Should that be allowed?



And how should the rules be for mixing with class helpers? (In case of 
conflicting names)

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

Re: [fpc-pascal] with in classes/records

2018-09-09 Thread Ryan Joseph


> On Sep 9, 2018, at 5:01 PM, Martin  wrote:
> 
> And how should the rules be for mixing with class helpers? (In case of 
> conflicting names)

On the dev list Sven told me to use the tcallcandidates class to resolve 
overloads and I believe this handles searching class helpers also. So I guess 
the answer is whatever is standard behavior in FPC.

Since the base class takes precedence the example would search in the order:

TWrapper
THelperA
THelperB

If that’s allowed it’s basically the same as subclassing but in records.

Regards,
Ryan Joseph

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

Re: [fpc-pascal] with in classes/records

2018-09-09 Thread Michael Van Canneyt



On Sun, 9 Sep 2018, Ryan Joseph wrote:


It seems syntacticly possible that default properties could be recursive by 
having a default property reference a record/class with another default 
property. Should that be allowed?


I don't think so. Let's start with 1 level.
For default arrays it's also only one level deep.

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

Re: [fpc-pascal] Resource compilation

2018-09-09 Thread Martok
More Progress!

I've since finished STRINGTABLE and VERSIONINFO as well as mathematical 
expressions.

However, there's an issue I hope somebody can help with. Binutils has this test
case:



Every Resource compiler I have tried compiles this slightly differently, and
Resource Hacker doesn't understand one of them. Could somebody test this with MS
RC and share the res file?


Independently, TVersionResource emits one Translation block per translation
instead of one containing all translations. I take it that isn't formally wrong,
but it's also not optimal? Was this intentional?

-- 
Regards,
Martok

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

Re: [fpc-pascal] Resource compilation

2018-09-09 Thread Marco van de Voort
In our previous episode, Martok said:
> However, there's an issue I hope somebody can help with. Binutils has this 
> test
> case:
> 
> 
> 
> Every Resource compiler I have tried compiles this slightly differently, and
> Resource Hacker doesn't understand one of them. Could somebody test this with 
> MS
> RC and share the res file?

I happened to have an old win8 sdk around (vs community edition didn't seem
to have "RC"). Anyway:

http://www.stack.nl/~marcov/funkyres.res

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

Re: [fpc-pascal] Resource compilation

2018-09-09 Thread Martok

> I happened to have an old win8 sdk around (vs community edition didn't seem
> to have "RC"). Anyway:
> 
> http://www.stack.nl/~marcov/funkyres.res
Thank you!

Funky indeed, I'll mark that down as a Reshacker bug then.

Off to String stuff then.

-- 
Regards,
Martok


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

Re: [fpc-pascal] with in classes/records

2018-09-09 Thread Sven Barth via fpc-pascal

Am 09.09.2018 um 16:16 schrieb Michael Van Canneyt:



On Sun, 9 Sep 2018, Ryan Joseph wrote:

It seems syntacticly possible that default properties could be 
recursive by having a default property reference a record/class with 
another default property. Should that be allowed?


I don't think so. Let's start with 1 level.
For default arrays it's also only one level deep.

Ehm... news flash:

=== code begin ===

{$mode objfpc}

type
  TTest1 = class
  private
    fField: LongInt;
    function GetStuff(Index: Integer): Integer;
  public
    property Stuff[Index: Integer]: Integer read GetStuff; default;
  end;

  TTest2 = class
  private
    function GetTest(Index: Integer): TTest1;
  public
    property Test[Index: Integer]: TTest1 read GetTest; default;
  end;

{ TTest2 }

function TTest2.GetTest(Index: Integer): TTest1;
begin
  Result := TTest1.Create;
  Result.fField := Index;
end;

{ TTest1 }

function TTest1.GetStuff(Index: Integer): Integer;
begin
  Result := Index * fField;
end;

var
  Test: TTest2;
begin
  Test := TTest2.Create;
  Writeln(Test[21][2]);
end.

=== code end ===

Compiles and prints

=== output begin ===

42

=== output end ===

Though one can argue that default array properties are used explicitely 
using the "[…]"-syntax while a non-array default property is 
automatically triggered with ".".


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

Re: [fpc-pascal] with in classes/records

2018-09-09 Thread Michael Van Canneyt



On Sun, 9 Sep 2018, Sven Barth via fpc-pascal wrote:


Am 09.09.2018 um 16:16 schrieb Michael Van Canneyt:



On Sun, 9 Sep 2018, Ryan Joseph wrote:

It seems syntacticly possible that default properties could be 
recursive by having a default property reference a record/class with 
another default property. Should that be allowed?


I don't think so. Let's start with 1 level.
For default arrays it's also only one level deep.

Ehm... news flash:


I know that, but I meant you cannot immediatly go to the second level. 
You must specify the 2 indexes as in:



  Writeln(Test[21][2]);


Though one can argue that default array properties are used explicitely 
using the "[…]"-syntax while a non-array default property is 
automatically triggered with ".".


Yes.

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