douglascrockford / parseq

Better living thru immediacy!
216 stars 28 forks source link

Positional Arguments #3

Closed internalfx closed 6 years ago

internalfx commented 6 years ago

Thanks for sharing this library.

Can you explain your rationale why you chose positional arguments?

In the past for various other uses you have advocated for a spec object.

For example in parseq parallel

parseq.parallel(
    required_array,
    optional_array,
    time_limit,
    time_option,
    throttle
)

If I wanted to only throttle a list of requestors my call looks like this.

parseq.parallel([requestors], [], undefined, undefined, 10)

I am forced to specify some unneeded values, and in the future if more functionality is required it will get even more complicated.

If a spec object was used instead features could be added without breakages.

And if a feature should be deprecated in the future it would be possible for your library to simply ignore it.

I would advocate for only required arguments being positional.

parseq.parallel(
    required_array,
    {spec/opts/whatever...}
)

thoughts?

douglascrockford commented 6 years ago

If it were 10 parameters, then clearly a spec object is the way to go. Five is on the line. I learned a lot in doing a similar package, so I am confident that I will not be deprecating features.

internalfx commented 6 years ago

Was the similar package "RQ"? Which seems to have disappeared.

douglascrockford commented 6 years ago

This is the upgrade.