Thanks to visit codestin.com
Credit goes to github.com

Skip to content

RequestHandler doesn't work with multiple invocations where self is the same type #83

@efjimm

Description

@efjimm

RequestHandler creates a closure over the passed in parameters by defining a new type and assigning to decls in that type. This partially works because Zig creates a new instantiation of the function for each different type passed as the anytype argument. However, when the function has already been instantiated for the type passed, the type declaration inside the function is re-used, and the decls get overwritten. This affects the simple_router example in the repo, where /geta, /getb, and /inca all share the same self type and thus share the same request handler.

zap.Router will have to find another way to pass the self argument to the routing functions.

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