Difference between revisions of "Delphi language features missing from the Free Pascal Compiler"

From Free Pascal wiki
Jump to navigationJump to search
(Added link to Class helpers page)
(Moved advanced records reference URL to 'already implemented')
(32 intermediate revisions by 10 users not shown)
Line 1: Line 1:
== New since Delphi 2007 ==
+
Note: some new Delphi features are already implemented in [[FPC_New_Features_Trunk|FPC trunk]].
==== Operator Overloading Syntax for records and classes ====
+
 
 +
== New since D4 ==  
 +
 
 +
=== Exporting of overloaded functions ===
 +
(version not entirely sure, but came in with overloading, so definitely pre-D6)
  
Delphi win32 compiler supports only operators for records. .Net compiler also supports classes.
+
In library packages select an overloaded variant to export. Assume we have some overloaded methods:
  
Info:
+
function doSomeThing(a:type1):type2;stdcall;
http://docwiki.embarcadero.com/RADStudio/en/Operator_Overloading
+
function doSomeThing(a:type3):type4;stdcall;
http://wiert.wordpress.com/2009/10/19/delphi-operator-overloading-table-of-operators-names-and-some-notes-on-usage-and-glitches/
 
  
==== Class Helpers ====
+
and in the library (for building the dll using the unit above) we want to export them:
  
http://www.prestwood.com/ASPSuite/KB/Document_View.asp?QID=101869
+
exports
http://blog.excastle.com/2007/08/29/unfinished-delphi-feature-of-the-day-virtual-class-helper-methods/
+
    doSomeThing(a:type1) name 'doSomeThingTYPE1',
 +
    doSomeThing(a:type3) name 'doSomeThingTYPE3';
  
They are currently being worked on. For more information see [[Class helpers]].
+
=== implements delegation of interfaces ===
  
==== Advanced Records ====
+
Delegating interfaces to classes is not always supported,
 +
* [http://bugs.freepascal.org/view.php?id=16531 Mantis 16531]
 +
* [http://bugs.freepascal.org/view.php?id=8951 Mantis 8591]
 +
* [http://bugs.freepascal.org/view.php?id=23403 Mantis 23403]
  
http://docwiki.embarcadero.com/RADStudio/en/Structured_Types#Records_.28advanced.29
+
== New since Delphi 2007 ==
  
 
== New since Delphi 2009 ==
 
== New since Delphi 2009 ==
==== Generics Syntax ====
 
  
A good delphi reference is here: http://docwiki.embarcadero.com/RADStudio/en/Generics_Index
 
 
==== Unicode string support ====
 
 
==== Anonymous Methods ====
 
==== Anonymous Methods ====
 
+
#http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/anonymousmethods_xml.html
http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/anonymousmethods_xml.html
+
#http://delphi.about.com/od/objectpascalide/a/understanding-anonymous-methods-in-delphi.htm
  
 
== New since Delphi 2010 ==
 
== New since Delphi 2010 ==
 
==== Custom Attributes ====
 
==== Custom Attributes ====
 +
Custom Attributes are a language feature in Delphi that allow annotating types and type members with special objects that carry additional information. Attributes extend the object-oriented model with aspect-oriented elements.
 +
 +
http://delphi.about.com/od/oopindelphi/a/delphi-attributes-understanding-using-attributes-in-delphi.htm
 +
 
==== Enhanced RTTI ====
 
==== Enhanced RTTI ====
==== Class constructors and destructors ====
+
http://docwiki.embarcadero.com/RADStudio/en/RTTI_directive_(Delphi)
http://blogs.embarcadero.com/abauer/2009/09/03/38898
 
  
 
==== Delayed directive ====
 
==== Delayed directive ====
Line 45: Line 51:
 
fpc wiki about that topic: http://wiki.freepascal.org/Dynamically_loading_headers
 
fpc wiki about that topic: http://wiki.freepascal.org/Dynamically_loading_headers
  
 +
Originally I thought that delayed is similar to weakexternal which FPC has for some platforms but after reading this: http://docwiki.embarcadero.com/CodeExamples/XE3/en/DelayedLoading_(Delphi) I understand that this is simply a wrapper around LoadLibrary and GetProcessAdress with automatic loading and unloading.--[[User:Paul Ishenin|Paul Ishenin]] 13:45, 18 January 2013 (UTC)
 +
 +
== Misc ==
 +
# [[packages|(Library) packages]]
 +
# "automated" keyword, which is like "public", but generates COM specific RTTI. Afaik this kind of COM usage is deprecated though.
 +
 +
== Already implemented ==
 +
=== FPC 3.0.4/trunk ===
 +
==== Advanced records ====
 +
http://docwiki.embarcadero.com/RADStudio/en/Structured_Types#Records_.28advanced.29
 +
 +
=== FPC 2.6.0 ===
 
==== AS and IS extended for interfaces ====
 
==== AS and IS extended for interfaces ====
 
+
New since Delphi 2010. Info is here:  
Info is here:  
 
 
#http://docwiki.embarcadero.com/RADStudio/en/Interface_References#Casting_Interface_References_to_Objects
 
#http://docwiki.embarcadero.com/RADStudio/en/Interface_References#Casting_Interface_References_to_Objects
 
#http://blogs.embarcadero.com/abauer/2009/08/21/38893
 
#http://blogs.embarcadero.com/abauer/2009/08/21/38893
  
== Misc ==
+
Implemented in FPC 2.6.0.
#using point in the unitname like: unit Borland.VCL.Types (since Delphi 7)
 
  
 
== Reference ==
 
== Reference ==
Line 58: Line 74:
 
#http://edn.embarcadero.com/article/images/39076/New_Delphi_Coding_Styles_and_Architectures.pdf
 
#http://edn.embarcadero.com/article/images/39076/New_Delphi_Coding_Styles_and_Architectures.pdf
 
#http://docwiki.embarcadero.com/RADStudio/en/What's_New_in_Delphi_and_C%2B%2BBuilder_2010
 
#http://docwiki.embarcadero.com/RADStudio/en/What's_New_in_Delphi_and_C%2B%2BBuilder_2010
 +
 +
[[Category:Delphi]]
 +
[[Category:FPC]]

Revision as of 23:23, 5 May 2018

Note: some new Delphi features are already implemented in FPC trunk.

New since D4

Exporting of overloaded functions

(version not entirely sure, but came in with overloading, so definitely pre-D6)

In library packages select an overloaded variant to export. Assume we have some overloaded methods:

function doSomeThing(a:type1):type2;stdcall; function doSomeThing(a:type3):type4;stdcall;

and in the library (for building the dll using the unit above) we want to export them:

exports

   doSomeThing(a:type1) name 'doSomeThingTYPE1',
   doSomeThing(a:type3) name 'doSomeThingTYPE3';

implements delegation of interfaces

Delegating interfaces to classes is not always supported,

New since Delphi 2007

New since Delphi 2009

Anonymous Methods

  1. http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/anonymousmethods_xml.html
  2. http://delphi.about.com/od/objectpascalide/a/understanding-anonymous-methods-in-delphi.htm

New since Delphi 2010

Custom Attributes

Custom Attributes are a language feature in Delphi that allow annotating types and type members with special objects that carry additional information. Attributes extend the object-oriented model with aspect-oriented elements.

http://delphi.about.com/od/oopindelphi/a/delphi-attributes-understanding-using-attributes-in-delphi.htm

Enhanced RTTI

http://docwiki.embarcadero.com/RADStudio/en/RTTI_directive_(Delphi)

Delayed directive

Info is here: http://docwiki.embarcadero.com/RADStudio/en/Libraries_and_Packages#Delayed_Loading Some info about internals:

  1. http://blogs.embarcadero.com/abauer/2009/08/25/38894
  2. http://blogs.embarcadero.com/abauer/2009/08/29/38896
  3. http://blogs.embarcadero.com/chrishesik/2009/11/02/35056

fpc wiki about that topic: http://wiki.freepascal.org/Dynamically_loading_headers

Originally I thought that delayed is similar to weakexternal which FPC has for some platforms but after reading this: http://docwiki.embarcadero.com/CodeExamples/XE3/en/DelayedLoading_(Delphi) I understand that this is simply a wrapper around LoadLibrary and GetProcessAdress with automatic loading and unloading.--Paul Ishenin 13:45, 18 January 2013 (UTC)

Misc

  1. (Library) packages
  2. "automated" keyword, which is like "public", but generates COM specific RTTI. Afaik this kind of COM usage is deprecated though.

Already implemented

FPC 3.0.4/trunk

Advanced records

http://docwiki.embarcadero.com/RADStudio/en/Structured_Types#Records_.28advanced.29

FPC 2.6.0

AS and IS extended for interfaces

New since Delphi 2010. Info is here:

  1. http://docwiki.embarcadero.com/RADStudio/en/Interface_References#Casting_Interface_References_to_Objects
  2. http://blogs.embarcadero.com/abauer/2009/08/21/38893

Implemented in FPC 2.6.0.

Reference

  1. http://edn.embarcadero.com/article/34324
  2. http://edn.embarcadero.com/article/images/39076/New_Delphi_Coding_Styles_and_Architectures.pdf
  3. http://docwiki.embarcadero.com/RADStudio/en/What's_New_in_Delphi_and_C%2B%2BBuilder_2010