In Java, if I want to delegate the foo and bar methods to my component a, I have to say something like:
public int foo(int x) {
return a.foo(x);
}
public void bar() {
a.bar();
}
Is there a programming language that natively supports delegation? I'm imagining something like:
delegate a: foo, bar;
This would make it much easier to choose composition over inheritance.
#ProgrammingLanguages #Java #oop #ObjectOrientedProgramming #programming
@peterdrake The SNIT object system for Tcl has a `delegate` command which does exactly this, see: https://core.tcl-lang.org/tcllib/doc/tcllib-1-18/embedded/www/tcllib/files/modules/snit/snit.html#subsection7
#tcltk #programming