Skip to content

Instantly share code, notes, and snippets.

@zah
Created August 26, 2011 14:41
Show Gist options
  • Save zah/1173554 to your computer and use it in GitHub Desktop.
Save zah/1173554 to your computer and use it in GitHub Desktop.
Type associations in Nimrod
type 3DSpace = ...
type Plane = ...
type Line = ...
proc SpaceSplitterType(p: Place) : Line
proc SpaceSplitterType(p: 3DSpace) : Plane
# This is a generic algorithm that should work both in 2D and 3D context
proc ComputeProjection[S](space: S) =
# instantiate the correct space splitter type (needed for the algorithm)
var splitter : type(SpaceSplitterType space)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment