proc `==`*[T: StringSlice or string](str: StringSlice, cmp: T): bool =
  if cmp.isNil():        return false
  if str.len != cmp.len: return false
  when T is StringSlice:
    for i in cmp.start..cmp.stop:
      if str.str[i + str.start] != cmp.str[i]: return false
    return true
  else:
    return str.startsWith(cmp)
template `==`*(str: string, cmp: StringSlice): bool =
  cmp == str