Skip to content

Remove @return(undefined_to_opt) etc.? #7428

Open
@cknitt

Description

@cknitt

We currently have the following special directives for external function definitions:

@return(nullable)
external someFunc1: unit => option<string> = "someFunc"

@return(null_undefined_to_opt)
external someFunc2: unit => option<string> = "someFunc"

@return(undefined_to_opt)
external someFunc3: unit => option<string> = "someFunc"

@return(null_to_opt)
external someFunc4: unit => option<string> = "someFunc"
  • 1 and 2 are actually the same.
  • For 2, 3, and 4, the naming is unidiomatic (no camelCase, ...).
  • 3 is probably not needed anymore as one could just define the external to return an option.
  • 4 would be for a case where we know that the external function can return null, but not undefined. But in that case using 1 would work as well?

I would suggest to deprecate and eventually remove everything but @return(nullable) (which is actually the only one that's documented BTW).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions