Skip to content

Instantly share code, notes, and snippets.

Created August 1, 2022 18:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
This is not real source code. The extension here is only for minimal highlighting.
Context :: struct
allocator : Allocator;
assertion_failure_handler : Assertion_Failure_Handler;
logger : Logger;
// 'context' is a reserved keyword.
// It refers to the currently bound context.
// 'action' doesn't need to know the context type.
// What to do in case it's called without the required context? compilation error! -_-
action :: procedure ()
print("Mode: {}\n", context.mode);
ActionContext :: struct
using base: Context;
mode: String;
main :: ()
action_context : ActionContext = { ...context, "Fast" };
using action_context
return action();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment