Rafael Schouten
Rafael Schouten
It would be great to get something solid that did this. There is also https://github.com/rdeits/Flatten.jl and my awful hack https://github.com/rafaqz/CompositeFieldVectors.jl. I've been playing with flattening nested structs in various ways...
I currently use this branch: https://github.com/rafaqz/CompositeFieldVectors.jl/tree/manual I stopped using the getfield/setfield methods I was originally using with structs of type Any and now I just do a complete rebuild of...
The interesting things are here: https://github.com/rafaqz/CompositeFieldVectors.jl/blob/manual/src/constructors.jl I'm currently playing with using `@pure` for type stability but it's fickle and I don't think it's a good strategy
That makes sense, I don't really have any fields like that. But you could just define another layer of metafield: ```julia @metafield flattenable2 true @flattenable2 @flattenable mutable struct Test a::Int...
Updating: my [fork](https://github.com/rafaqz/Flatten.jl) of Flatten.jl now incorporates the `@flattenable` metafield and is type stable and probably as fast as this can get for flatten/reconstruct of nested structs. But there are...
I'm not totally sure! But no its not necessarily pure. Firstly it seems `@generated` functions are very conservative with world age, using the point they are declared rather than when...
Evil! But yeah I admit its pretty bad... It mostly arose from already having that method in a non-`@generated` context and just mashing them together while still learning how `@generated`...
Sure, I'll keep thinking about it too. This technique is going to be central to all my work for the next year. But I'll keep using the evil version until...
Yeah I think only a few core devs really know exactly what pure means in Julia... In this case I'm pretty obviously breaking purity by overriding methods that are used...
I thought you might be vaguely interested, we have a few use cases for Flatten.jl, flattening nested structs for derivatives/optimisation etc. Its really the most important problem for my modelling...