parlour icon indicating copy to clipboard operation
parlour copied to clipboard

Improved and enforced consistency between Namespace#create_x and X#initialize

Open AaronC81 opened this issue 4 years ago • 0 comments

It would be good to ensure that the signatures for Namespace#create_x methods are the same as the signatures for the corresponding X#initialize methods (besides the generator parameter), improving the internal consistency of Parlour.

For example, the signature for Namespace#create_method is:

def create_method(name, parameters: nil, return_type: nil, returns: nil, abstract: false, ...)

But the signature for Method#initialize uses some positional arguments as keyword arguments instead:

def initialize(generator, name, parameters, return_type = nil, abstract: false, ...)

(This would have to be considered a breaking change.)

This consistency could also to enforced in tests by having a test which grabs method parameters and compares for each, adding a layer of protection against adding a parameter to one but not the other by accident.

AaronC81 avatar May 14 '20 21:05 AaronC81