Skip to content

convention for labeled arguments #26

@woeps

Description

@woeps

I started looking at Core__Array.resi and found inconsistencies regarding the usage of labeled arguments. Afaik, this is also true in other modules.

When should labeled arguments be used?
A convention should be found to provide a consistent api surface.


Examples from Core__Array.resi

copyWithin

all labeled arguments but the one being operared on:

external copyWithin: (array<'a>, ~target: int, ~start: int, ~end: int) => array<'a> = "copyWithin"

fillInPlace

usage of labeled and non-labeled arguments within a single function:

@send external fillInPlace: (array<'a>, 'a, ~start: int, ~end: int) => unit = "fill"

pushMany

no usage of any labeled arguments:

@variadic @send external pushMany: (array<'a>, array<'a>) => unit = "push"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions