I’m seeing feature this in other languages and it’s pretty useful. Has anyone 
ever considered this for Pascal?

Instead of declaring a method in the class (or other function) it’s written 
inline from the callers scope and inherits from that scope. The only advantage 
is readability since everything appears in one line and it’s cleaner since you 
don’t pollute the class with methods are only used in a single location and 
never called directly.

procedure TMyClass.FadeOut; 
var
        fadeAction: TSpriteAction;
begin
        fadeAction := TAction.ActionWithDuration(self, 2.0);
        fadeAction.SetEndedAction(@
                begin
                        ... // scoped in the calling class so "self" is 
available
                end;
        );
        fadeAction.FadeOut;
end;    

Regards,
        Ryan Joseph

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

Reply via email to