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

Related issues

alaviss picture alaviss  路  3Comments

teroz picture teroz  路  3Comments

juancarlospaco picture juancarlospaco  路  3Comments

hlaaftana picture hlaaftana  路  3Comments

ghost picture ghost  路  4Comments