Skip to content

Proposal: Anonymous function literals #20242

Closed as not planned
Closed as not planned
@Darkfllame

Description

@Darkfllame

First off, I know that proposals are closed, but i think a lot of project could benefits from that.

A minor addition: ononymous function literals, basically they're syntax sugar for struct { fn inner(...){...}}.inner, as fn(...) {...}, this could be super useful especially in callback-based APIs like GLFW, SDL (in some points) or other zig libraries (i don't have example ;( ).

I really hope this feature is added to zig since it's really annoying typing the whole struct thing or making a whole new function just for a simple callback.

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