Hello @aseigo, thank you for your response,
I wanted something a little bit more complex, I need more composition. This small example in Ruby maybe helps:
class UploaderBase
def upload(io, options)
store.upload(io, options)
end
def delete(name)
store.delete(name)
end
end
class Plugin::Backup
def upload(io, options)
super
backup_store.save(io, options)
end
def delete(name)
super
backup_store.delete(name)
end
end
class Plugin::Validation
def upload(io, options)
if validate?(io, options)
super
end
end
end
Then the user of the library do something like this:
class MyImageUploader
include UploaderBase
plug :backup, store_backup: :s3
plug :validation
def validate?(io, options)
io.size < 3.megas
end
end
So basically, I want to be able to use my parent behavior and only if need it, add more functions in plugins, etc. As far I understand, I cannot achieve this with behavior, only a simple polymorphism. The middleware I linked in my previous post may work, but do it for each function for each module seems too much.
And yes, I want to do it because I will need it in the future, but mostly to learn Elixir in a more realistic scenario.
Thank you for your links.


















