Nim: [Generics] Can't infer generic params via a constructor

Created on 20 Jul 2019  路  2Comments  路  Source: nim-lang/Nim

type Foo[T] = object
  a: T

var 
  bar = Foo[int](a: 1) # okay
  baz = Foo(a: 2)      # Error: object constructor needs an object type

Generic procs already have some inference capability, why not constructors?

Feature Generics Type inference

Most helpful comment

Because nobody ever implemented this feature. Features start in the unfortunate state "Unimplemented".

All 2 comments

Because nobody ever implemented this feature. Features start in the unfortunate state "Unimplemented".

Was this page helpful?
0 / 5 - 0 ratings