Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.

Public Report
Report From: Delphi-BCB/Compiler/Delphi/Language    [ Add a report in this area ]  
Report #:  78314   Status: Open
Class Signatures
Project:  Delphi Build #:  3449
Version:    14.0 Submitted By:   m. Th.
Report Type:  New Feature Request Date Reported:  10/2/2009 10:21:14 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   273179
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 8
Description
Please implement Class Signatures as a way to allow the developer to group together classes which have a some members which fulfill the same type definition. Also will greatly enhance the expression power of the generics. An example:

00000001 Unit Signatures;
00000002
00000003 interface
00000004
00000005 type
00000006   TDSSig = class signature
00000007     procedure Repaint;
00000008     property Color: TColor;
00000009     property DataSource: TDataSource;
00000010   end;
00000011
00000012 procedure UpdateStatus(aObject: TDSSig);
00000013
00000014 implementation
00000015
00000016 procedure UpdateStatus(aObject: TDSSig);
00000017 var
00000018   nColor: TColor;
00000019  
00000020 begin
00000021   nColor:=clGrayText;
00000022   if Assigned(aObject.DataSource) then
00000023     if Assigned(aObject.DataSource.DataSet) then
00000024       nColor:=clWindow;
00000025      
00000026   aObject.Color:=nColor; //assign
00000027   aObject.Repaint; //not really needed - just an example
00000028 //
aObject.Left:=42; - this would give a Syntax Error
00000029 end;
00000030
00000031 end. //Unit Signatures
00000032
00000033 ----8<--------8<--------8<--------8<--------8<--------8<----
00000034
00000035 Program UseIt; //here we actually use the feature
00000036
00000037 begin
00000038   UpdateStatus(DBEdit1);
00000039   UpdateStatus(DBGrid1);
00000040 //
UpdateStatus(OpenDialog1); - 'Signature not Match Error'
00000041 end;

We mention that the Class Signatures actually doesn't have any 'life' (hence no life management) - treat them as a skeleton, a template - something like an interface but not on premise but on demand.

Ideally, the Class Signatures must support inheritance and for properties the 'Read' and 'Write' specifiers.

More details you can see in

http://wings-of-wind.com/2009/09/22/what-about-class-types/
https://forums.embarcadero.com/thread.jspa?threadID=25254&tstart=0

NOTE: I called them 'Class Types' but Class Signatures is a way better name in order to distinguish them from the Haskell's class types.
Steps to Reproduce:
None
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01