> On May 10, 2021, at 3:18 PM, Ryan Joseph <generic...@gmail.com> wrote:
> Lets focus on the record approach for now then. I don't think I know enough 
> to understand where are the pitfalls are.

This was another thing I wanted off my mind since a couple years ago already so 
I got a pretty good start of an implementation. Since Sven has made it pretty 
clear we can't add ARC to Pascal without altering all instances of TObject, 
this is the next best thing. Together with record management operators this is 
how we can achieve "smart pointers" in Pascal.

I've constrained the implementation to hoisting the following members:

* Fields (duplicate field names with the record gives errors)
* Properties (last-wins, like in class hierarchies)
* Methods (and overloading with the method itself)
* for..in enumerator so container classes can be used naturally (other 
operators are not supported to keep the implementation simple for 99% use cases)
* Hoisting happens only by subscripting from the outside, so not within the 
record using implicit-self.
* Only records + classes are supported types (in the interest of keep the 
feature for ARC and not other things like nullable types or traits/mix-ins 


        Ryan Joseph

fpc-devel maillist  -  fpc-devel@lists.freepascal.org

Reply via email to