I noticed the following anomaly:
    
    
    import std/paths
    nim> let path = Path "/dir/root.ext"
    nim> echo $path
    Error: type mismatch
    Expression: $path
      [1] path: Path
    
    Expected one of (first mismatch at [position]):
    [1] func `$`(x: float | float32): string
    [1] func `$`(x`gensym0: `{}`(int, lit)): string
    [1] func `$`(x`gensym1: `{}`(uint64, lit)): string
    [1] func `$`(x`gensym2: `{}`(int64, lit)): string
    [1] proc `$`(s: WideCString): string
    [1] proc `$`(s: WideCStringObj): string
    [1] proc `$`(s: WideCStringObj; estimate: int; replacement: int = 
0x0000FFFD): string
    [1] proc `$`(t: typedesc): string
    [1] proc `$`(w: WideCString; estimate: int; replacement: int = 0x0000FFFD): 
string
    [1] proc `$`(x: bool): string
    [1] proc `$`(x: char): string
    [1] proc `$`(x: cstring): string
    [1] proc `$`(x: int): string
    [1] proc `$`(x: int64): string
    [1] proc `$`(x: string): string
    [1] proc `$`(x: uint64): string
    [1] proc `$`[Enum: enum](x: Enum): string
    [1] proc `$`[T, IDX](x: array[IDX, T]): string
    [1] proc `$`[T, U](x: HSlice[T, U]): string
    [1] proc `$`[T: object](x: T): string
    [1] proc `$`[T: tuple](x: T): string
    [1] proc `$`[T](x: openArray[T]): string
    [1] proc `$`[T](x: seq[T]): string
    [1] proc `$`[T](x: set[T]): string
    
    
    Run

I see that coercing the Path to string works fine:
    
    
    import std/paths
    nim> let p = Path "/dir/name.ext"
    echo echo p.string # => /dir/name.ext
    
    
    Run

or if I define $ myself it works:
    
    
    import std/paths
    let p = Path "/dir/name.ext"
    nim> proc `$`(path: Path): string = path.string
    nim> echo $p # => /dir/name.ext
    
    
    Run

Just wondering if $ should be added to std/paths??

Reply via email to