allocate -> Class #89
                
     Open
            
            
          
  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_instanceon 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
allocatemethod to produce theClasstype as output as it's a convenience method. If it were justAnyObjectone could simply usesend("allocate", None)and get what they want. But withAnyObjectthe 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
AnyObjectas the convenience ofsendis already there.new_instancegoes through bothClass.newandClass.initializewhich both have been known to be re-written by software developers.Class.allocatecan 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. Sinceallocateis a raw instance of a class by definition I believe this form of implementation forallocatein ruru just makes sense.Resolves #83