Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-10

Record Method and Operators

7 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Cesar Romero

Hi,

Im wondering if FPC Team have plans to support Record Methods/Operators in future versions of FPC
I read the actual "Future plans" and the most closed item is "RTL:: More compatibility with later Delphi versions."
But it do not means that records can be changed.

I want to implement my ValueTypes using record with implicit operators and constructor/destructor, like this code written by a friend, Lee Nover.

 TSpecifier = record
   S: AnsiString;
   WS: WideString;
   Intf: IInterface;
   class operator Implicit(const S: AnsiString): TSpecifier;
   class operator Implicit(const C: Cardinal): TSpecifier;
   class operator Implicit(const D: Double): TSpecifier;
   class operator Implicit(const I: Integer): TSpecifier;
   class operator Implicit(const I64: Int64): TSpecifier;
   class operator Implicit(const V: TValue): TSpecifier;
   class operator Implicit(const WS: WideString): TSpecifier;
   class operator Implicit(const Intf: IInterface): TSpecifier;
   class operator Implicit(const Spec: TSpecifier): AnsiString;
   class operator Implicit(const Spec: TSpecifier): Cardinal;
   class operator Implicit(const Spec: TSpecifier): Double;
   class operator Implicit(const Spec: TSpecifier): Integer;
   class operator Implicit(const Spec: TSpecifier): Int64;
   class operator Implicit(const Spec: TSpecifier): TValue;
   class operator Implicit(const Spec: TSpecifier): WideString;
   class operator Implicit(const Spec: TSpecifier): IInterface;
   case NativeType: Integer of
     varInteger: (I: Integer);
     varInt64: (I64: Int64);
     varLongWord: (C: Cardinal);
     varDouble: (D: Double);
     varObject: (O: TValue);
 end;

My plans is to have a single framework compatible with Delphi 2007/2009 and FPC, so Ill not use some D2009 only resources, but implicit operators make the live of users very better to write less and better code.

Can I have any hope about this subject?

Florian Klaempfl
to Cesar Romero
Show quoted text 47 lines
Hi, Im wondering if FPC Team have plans to support Record Methods/Operators in future versions of FPC I read the actual "Future plans" and the most closed item is "RTL:: More compatibility with later Delphi versions." But it do not means that records can be changed. I want to implement my ValueTypes using record with implicit operators and constructor/destructor, like this code written by a friend, Lee Nover. TSpecifier = record S: AnsiString; WS: WideString; Intf: IInterface; class operator Implicit(const S: AnsiString): TSpecifier; class operator Implicit(const C: Cardinal): TSpecifier; class operator Implicit(const D: Double): TSpecifier; class operator Implicit(const I: Integer): TSpecifier; class operator Implicit(const I64: Int64): TSpecifier; class operator Implicit(const V: TValue): TSpecifier; class operator Implicit(const WS: WideString): TSpecifier; class operator Implicit(const Intf: IInterface): TSpecifier; class operator Implicit(const Spec: TSpecifier): AnsiString; class operator Implicit(const Spec: TSpecifier): Cardinal; class operator Implicit(const Spec: TSpecifier): Double; class operator Implicit(const Spec: TSpecifier): Integer; class operator Implicit(const Spec: TSpecifier): Int64; class operator Implicit(const Spec: TSpecifier): TValue; class operator Implicit(const Spec: TSpecifier): WideString; class operator Implicit(const Spec: TSpecifier): IInterface; case NativeType: Integer of varInteger: (I: Integer); varInt64: (I64: Int64); varLongWord: (C: Cardinal); varDouble: (D: Double); varObject: (O: TValue); end; My plans is to have a single framework compatible with Delphi 2007/2009 and FPC, so Ill not use some D2009 only resources, but implicit operators make the live of users very better to write less and better code. Can I have any hope about this subject?

What does it prevent you from using FPC's operator overloading capabilities to do so which has FPC for 10 years?

Cesar Romero
to Florian Klaempfl
Florian Klaempfl wrote 55 lines
Cesar Romero schrieb: > Hi, > > Im wondering if FPC Team have plans to support Record Methods/Operators > in future versions of FPC > I read the actual "Future plans" and the most closed item is "RTL:: More > compatibility with later Delphi versions." > But it do not means that records can be changed. > > I want to implement my ValueTypes using record with implicit operators > and constructor/destructor, like this code written by a friend, Lee Nover. > > TSpecifier = record > S: AnsiString; > WS: WideString; > Intf: IInterface; > > class operator Implicit(const S: AnsiString): TSpecifier; > class operator Implicit(const C: Cardinal): TSpecifier; > class operator Implicit(const D: Double): TSpecifier; > class operator Implicit(const I: Integer): TSpecifier; > class operator Implicit(const I64: Int64): TSpecifier; > class operator Implicit(const V: TValue): TSpecifier; > class operator Implicit(const WS: WideString): TSpecifier; > class operator Implicit(const Intf: IInterface): TSpecifier; > > class operator Implicit(const Spec: TSpecifier): AnsiString; > class operator Implicit(const Spec: TSpecifier): Cardinal; > class operator Implicit(const Spec: TSpecifier): Double; > class operator Implicit(const Spec: TSpecifier): Integer; > class operator Implicit(const Spec: TSpecifier): Int64; > class operator Implicit(const Spec: TSpecifier): TValue; > class operator Implicit(const Spec: TSpecifier): WideString; > class operator Implicit(const Spec: TSpecifier): IInterface; > > case NativeType: Integer of > varInteger: (I: Integer); > varInt64: (I64: Int64); > varLongWord: (C: Cardinal); > varDouble: (D: Double); > varObject: (O: TValue); > end; > > My plans is to have a single framework compatible with Delphi 2007/2009 > and FPC, so Ill not use some D2009 only resources, but implicit > operators make the live of users very better to write less and better code. > > Can I have any hope about this subject? > What does it prevent you from using FPC's operator overloading capabilities to do so which has FPC for 10 years? _______________________________________________

I guess... nothing, but I cant find any docs until now, I googled about that and search on fpc site.
If I can find docs about that and it can work as I expect, Ill use of cource.

Cesar Romero
to Florian Klaempfl: What does it prevent you from using FPC's operator overloading capabilities to do so…
Florian Klaempfl wrote 58 lines
Cesar Romero schrieb: > Hi, > > Im wondering if FPC Team have plans to support Record Methods/Operators > in future versions of FPC > I read the actual "Future plans" and the most closed item is "RTL:: More > compatibility with later Delphi versions." > But it do not means that records can be changed. > > I want to implement my ValueTypes using record with implicit operators > and constructor/destructor, like this code written by a friend, Lee Nover. > > TSpecifier = record > S: AnsiString; > WS: WideString; > Intf: IInterface; > > class operator Implicit(const S: AnsiString): TSpecifier; > class operator Implicit(const C: Cardinal): TSpecifier; > class operator Implicit(const D: Double): TSpecifier; > class operator Implicit(const I: Integer): TSpecifier; > class operator Implicit(const I64: Int64): TSpecifier; > class operator Implicit(const V: TValue): TSpecifier; > class operator Implicit(const WS: WideString): TSpecifier; > class operator Implicit(const Intf: IInterface): TSpecifier; > > class operator Implicit(const Spec: TSpecifier): AnsiString; > class operator Implicit(const Spec: TSpecifier): Cardinal; > class operator Implicit(const Spec: TSpecifier): Double; > class operator Implicit(const Spec: TSpecifier): Integer; > class operator Implicit(const Spec: TSpecifier): Int64; > class operator Implicit(const Spec: TSpecifier): TValue; > class operator Implicit(const Spec: TSpecifier): WideString; > class operator Implicit(const Spec: TSpecifier): IInterface; > > case NativeType: Integer of > varInteger: (I: Integer); > varInt64: (I64: Int64); > varLongWord: (C: Cardinal); > varDouble: (D: Double); > varObject: (O: TValue); > end; > > My plans is to have a single framework compatible with Delphi 2007/2009 > and FPC, so Ill not use some D2009 only resources, but implicit > operators make the live of users very better to write less and better code. > > Can I have any hope about this subject? > What does it prevent you from using FPC's operator overloading capabilities to do so which has FPC for 10 years? _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

freepascal search is not working,
With google I found
http://courses.cs.vt.edu/~cs3304/FreePascal/doc/ref/node12.html

Interesting but is not what I mention, it is just the basic.

Florian Klaempfl
to Cesar Romero
Show quoted text 67 lines
Florian Klaempfl escreveu: > Cesar Romero schrieb: > >> Hi, >> >> Im wondering if FPC Team have plans to support Record Methods/Operators >> in future versions of FPC >> I read the actual "Future plans" and the most closed item is "RTL:: More >> compatibility with later Delphi versions." >> But it do not means that records can be changed. >> >> I want to implement my ValueTypes using record with implicit operators >> and constructor/destructor, like this code written by a friend, Lee >> Nover. >> >> TSpecifier = record >> S: AnsiString; >> WS: WideString; >> Intf: IInterface; >> >> class operator Implicit(const S: AnsiString): TSpecifier; >> class operator Implicit(const C: Cardinal): TSpecifier; >> class operator Implicit(const D: Double): TSpecifier; >> class operator Implicit(const I: Integer): TSpecifier; >> class operator Implicit(const I64: Int64): TSpecifier; >> class operator Implicit(const V: TValue): TSpecifier; >> class operator Implicit(const WS: WideString): TSpecifier; >> class operator Implicit(const Intf: IInterface): TSpecifier; >> >> class operator Implicit(const Spec: TSpecifier): AnsiString; >> class operator Implicit(const Spec: TSpecifier): Cardinal; >> class operator Implicit(const Spec: TSpecifier): Double; >> class operator Implicit(const Spec: TSpecifier): Integer; >> class operator Implicit(const Spec: TSpecifier): Int64; >> class operator Implicit(const Spec: TSpecifier): TValue; >> class operator Implicit(const Spec: TSpecifier): WideString; >> class operator Implicit(const Spec: TSpecifier): IInterface; >> >> case NativeType: Integer of >> varInteger: (I: Integer); >> varInt64: (I64: Int64); >> varLongWord: (C: Cardinal); >> varDouble: (D: Double); >> varObject: (O: TValue); >> end; >> >> My plans is to have a single framework compatible with Delphi 2007/2009 >> and FPC, so Ill not use some D2009 only resources, but implicit >> operators make the live of users very better to write less and better >> code. >> >> Can I have any hope about this subject? >> > > What does it prevent you from using FPC's operator overloading > capabilities to do so which has FPC for 10 years? > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > freepascal search is not working, With google I found http://courses.cs.vt.edu/~cs3304/FreePascal/doc/ref/node12.html Interesting but is not what I mention, it is just the basic.

In which regard, quoting: "The assignment operator is also used to convert types from one type to another. The compiler will consider all overloaded assignment operators till it finds one that matches the types of the left hand and right hand expressions. If no such operator is found, a 'type mismatch' error is given. " ? It's not our fault that CG choose another syntax.

Cesar Romero
to Florian Klaempfl

Florian,

Show quoted text 8 lines
In which regard, quoting: "The assignment operator is also used to convert types from one type to another. The compiler will consider all overloaded assignment operators till it finds one that matches the types of the left hand and right hand expressions. If no such operator is found, a 'type mismatch' error is given. " ? It's not our fault that CG choose another syntax. _______________________________________________

It is nobody fault, Im happy to have FPC around, and all resources is welcome.

But my question was "Is there any plans to support a compatible sintaxe"? Yes, Maybe or No, will be a good answer.

I dont want to blame FPC team or Delphi Team, I hope I can have a compatible sintaxe,
and asking here I think I have more changes to get a positive answer.

Thank you,

Florian Klaempfl
to Cesar Romero
Show quoted text 14 lines
Florian, > In which regard, quoting: "The assignment operator is also used to > convert types from one type to another. The compiler will consider all > overloaded assignment operators till it finds one that matches the types > of the left hand and right hand expressions. If no such operator is > found, a 'type mismatch' error is given. " ? It's not our fault that CG > choose another syntax. > _______________________________________________ > It is nobody fault, Im happy to have FPC around, and all resources is welcome. But my question was "Is there any plans to support a compatible sintaxe"? Yes, Maybe or No, will be a good answer.

Unlikely to be done by the current developers, it simply duplicates functionality.

I dont want to blame FPC team or Delphi Team, I hope I can have a compatible sintaxe, and asking here I think I have more changes to get a positive answer.

Indeed, if someone submits a patch ;)