Skip to content

Instantly share code, notes, and snippets.

@BitPuffin
Last active August 29, 2015 13:57
Show Gist options
  • Save BitPuffin/9718515 to your computer and use it in GitHub Desktop.
Save BitPuffin/9718515 to your computer and use it in GitHub Desktop.
type TFoo* = object
yatamo*: string
proc yo*(a: TFoo, wa: int): string
proc ha*(a: TFoo, woo: string): int
when defined(macosx):
TFoo.bar = TMacBar # Works iff the code is ran statically
TFoo.baz = TMacBaz
proc yo(a: TFoo, wa: int): string =
a.bar.str
proc ha(a: TFoo, woo: string): int=
a.baz.int
elif defined(windows):
TFoo.bar = TWindowsBar
TFoo.bar = TWindowsBaz
# and so on
else:
TFoo.bar = TUnixBar
# Unix has no UnixBaz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment