Skip to content

Instantly share code, notes, and snippets.

@gingerBill
Last active August 9, 2025 08:50
Show Gist options
  • Save gingerBill/27aec0cd434f2be58d024dccef6e8d13 to your computer and use it in GitHub Desktop.
Save gingerBill/27aec0cd434f2be58d024dccef6e8d13 to your computer and use it in GitHub Desktop.
Procedure Signature Styles and Ambiguities
Prefix/Odin Require Return Type Return Named Inputs
Empty Procedure proc() () -> void ()
1 input, unnamed proc(int) (int) -> void
1 input, named proc(x: int) (x: int) -> void (x: int)
1 input, 1 output proc(int) -> int (x: int) -> int (x: int) -> int
2 inputs, 2 unnamed outputs proc(int, int) -> (int, int) (int, int) -> (int, int) (x: int, y: int) -> (int, int)
0 inputs, 2 named outputs proc() -> (a: int, b: int) () -> (a: int, b: int)
2 inputs, 2 outputs, all named proc(a, b: int) -> (c, d: int) (a, b: int) -> (c, d: int)

Prefix/Odin Style

Advantages: Allows for any approach and any style of a procedure signature

Disadvantages: Requires an extra keyword or sigil

Require Return Type Style

Advantages: Allows for most approaches of a procedure signature

Disadvantages: Requires the concept of void in the language

Return Named Inputs

Advantages: Does not require the concept of void in the language, allow for the return value to be omitted

Disadvantages: It's worse than the other two styles in every other way

()
() -> int
(int) // ambiguity
(x: int)
(x: int) -> int
(x: int) -> (int, int) // ambiguity
(int) -> (int, int) // ambiguity
(x: int) -> (x: int, y: int) // ambiguity
(x: int) -> (y, z: int) // ambiguity
Solutions:
* Prefix
* Return value
* Named inputs and not named outputs
// Prefix (best compromise with the most options)
proc()
proc() -> int
proc(int)
proc(x: int)
proc(x: int) -> int
proc(x: int) -> (int, int)
proc(int) -> (int, int)
proc(x: int) -> (y: int, z: int)
proc(x: int) -> (y, z: int)
// Return value
() -> void
() -> int
(int) -> void
(x: int) -> void
(x: int) -> int
(x: int) -> (int, int)
(int) -> (int, int)
(x: int) -> (int, int)
(x: int) -> (y: int, z: int) // possible but harder to parse
(x: int) -> (y, z: int) // possible but harder to parse
// Named inputs
()
() -> int
(x: int) -> void
(x: int) -> int
(x: int) -> (int, int)
(x: int) -> (y: int, z: int) // ambiguity
(x: int) -> (y, z: int) // ambiguity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment