On 10/02/2021 16:59, Ryan Joseph via fpc-pascal wrote:
• PHP (trait): https://www.php.net/manual/en/language.oop5.traits.php


The example exposes another aspect:

|trait SayWorld {
    public function sayHello() {
parent::sayHello();|

|In this case the trait has access to the object/class into which it is embedded. (otherwise it could not call the inherited method of the outer class).

Is that wanted?
(methods and fields?)

If that is wanted....
- If it will be using the existing "object" (or advanced record), then such code is not possible.
- One might have to think about how to declare what a trait can access?
   Just allow anything in the code, and attempt to resolve when the trait is embedded? IMHO maybe not?

|
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to