wyhaines/Send.cr

Can't `send` to inherited methods

Opened this issue · 0 comments

struct Int32
  include Send
end

Send.activate

123.send(:digits, 16)  # -> [11, 7]

Currently, this does not work, and errors like so:

Can not send to 'digits'; check that it exists and all arguments have type specifications. (Send::MethodMissing)

The default should be that it is possible to send to any method, whether directly defined in a class, or inherited. It SHOULD be possible to override this, to get the current behavior if one knows that one won't need access to all of those methods, or it creates a situation where the inheritance tree means that there are just far more methods getting mapped than will ever be dispatched to dynamically.