The @delegate macro does exist and is used (internally) in DataStructures.jl.
Cheers, Kevin On Sat, Apr 25, 2015 at 12:10 PM, Mauro <[email protected]> wrote: > > "https://github.com/JuliaLang/julia/pull/3292" > > Interesting, has it been implemented now? > No, check the bottom of the thread. But you can just use the macro: > > https://github.com/JuliaLang/julia/pull/3292/files > > > Maybe there is a more efficient method, since we are getting further > > away from the definition of Array by adding a data field, the > > commented source version is empty as in the OP, so when the > > constructor calls C it is storing the identifier "Array" somewhere. We > > can create a identical constructor with the difference that it accepts > > a keyword for what to write in place of Array. > > > > On 25/04/2015, Mauro <[email protected]> wrote: > >> On Sat, 2015-04-25 at 19:55, Marcus Appelros <[email protected] > > > >> wrote: > >>> Feels somehow sufficient to direct all functions to the data field. We > can > >>> > >>> have a macro like > >>> > >>> @foranyfunction f(c::Cubes,a::AnyArgs)=f(c.data,a) > >> > >> https://github.com/JuliaLang/julia/pull/3292 > >> > >>> "What you really want to be able to do is delegate everything to the > .data > >>> > >>> member, but there's no convenient way to do that" > >>> There are some existing macros that take a list of functions and define > >>> them on a type, we can wrap a macro that acts on all functions in > >>> methods(T). > >>> > >>> Or allow inheriting from concrete types. > >>> > >>> Or allow specifying abstract types like AbstractArray{T,N}. > >> > >> > >
