Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change interface of .act() callback functions #39

Open
arikon opened this issue Jul 19, 2013 · 3 comments
Open

Change interface of .act() callback functions #39

arikon opened this issue Jul 19, 2013 · 3 comments

Comments

@arikon
Copy link
Collaborator

arikon commented Jul 19, 2013

My proposal it to change API of .act() callbacks from

function(opts, args) {
}

to

function(options) {
   // options = opts + args
}

Motivation

  1. The difference between opts and args in semantical only and only make sense when command is run from the command line

  2. It is hard to explain to develepor what the difference between opts and args when it uses COA API to run command

  3. Division into two different arguments makes sense in case when opts is a hash and args is an array

  4. Compare

    var BEM = require('bem');
    BEM.api.create.block({ tech: ['css', 'js'] }, { names: ['b1', 'b2'] });

    and

    var BEM = require('bem');
    BEM.api.create.block({ names: ['b1', 'b2'], tech: ['css', 'js'] });

/cc @veged

@veged
Copy link
Owner

veged commented Jul 19, 2013

we can just add args to opts but keep second argument for act function for full backward compatibility

@arikon
Copy link
Collaborator Author

arikon commented Jul 19, 2013

@veged Backwards compatibility will broke if there were args and opts with the same name('...') declaration

@veged
Copy link
Owner

veged commented Jul 20, 2013

@arikon yep, but that's some kind "unsemantic" and seems nobody do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants