Skip to content

The too many arguments anti-pattern #321

Open
@ff6347

Description

@ff6347

While working on the reference I noted that we are having an JS anti pattern in Basil (IMHO). We have functions like rect(x, y, w, h, [tl], [tr], [br], [bl]). I know this is due to the relation to Processing but I find this pretty un-js-like. In my opinion this should actually be.

rect(options)

To keep it comparable to Processing and P5.js I would suggest something like this.

rect(x, y, w, h, options)

The rule of thumb could be all optional arguments are packed in an object. It would be even cooler if we could have both:

rect(x, y, w, h, options)
// and
rect(options)

This is nothing I need to happen for v2.0 but I wanted to start a discussion about it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions