I'm not sure the issue with the enum approach aside from not using static 
enums, given the following: 
    
    
    type
      FileSystemEntity* = enum
        File
        Directory
        Device
        UnknownEntity
      FilesystemLocality* = enum
        Absolute
        Relative
        UNC
      
      Path[Entity: static FileSystemEntity, Locale: static FilesystemLocality] 
= distinct string
      
      AbsoluteFile = Path[File, Absolute]
      RelativeFile = Path[File, Relative]
      AbsoluteDir = Path[Directory, Absolute]
      RelativeDir = Path[Directory, Relative]
    
    # some procs to test things out
    proc `$`*(p: Path): string = p.string
    proc open*(file: AbsoluteFile) =
      echo "opening " & file.string
    proc mkdir*(baseDir: AbsoluteDir, childDir: RelativeDir) =
      echo "making " &  childDir.string & " in " & baseDir.string
    open(AbsoluteFile("Hello"))
    #open(AbsoluteDir("Hello")) # doesnt compile
    mkDir(AbsoluteDir("Hello"), RelativeDir("./"))
    #mkDir(AbsoluteFile("Hello"), RelativeDir("./")) # nor do these
    #mkDir(AbsoluteFile("Hello"), AbsoluteDir("./"))
    
    
    Run

Reply via email to