Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
new_instance
on class produces an AnyObject which is okay but not preferred. As this is already baked in and depended upon I'd recommend changing that at 1.0 toClass
. (Or if it really goes the direction I would like it would beResult<Class, AnyException>
).I've chosen to implement the
allocate
method to produce theClass
type as output as it's a convenience method. If it were justAnyObject
one could simply usesend("allocate", None)
and get what they want. But withAnyObject
the worst case code would look likeSince
send("allocate", None)
is simple enough for anyone who really wants to protect their specific scenario then it becomes a simple choice for the to choose that orallocate() -> Class
.These are my thought on it. A convenience method which wouldn't make sense to implement as
AnyObject
as the convenience ofsend
is already there.new_instance
goes through bothClass.new
andClass.initialize
which both have been known to be re-written by software developers.Class.allocate
can be overwritten but I believe that's unheard of as it's sole purpose is to give you a raw instance of the class and not do anything else… so no exceptions are to be raised. Sinceallocate
is a raw instance of a class by definition I believe this form of implementation forallocate
in ruru just makes sense.Resolves #83