Whats wrong with initializing common fields independently?
proc foo(): MyObject =
let kind = kindA
result = case kind:
of kindA: MyObject(kind: kind, dataA: 1)
of kindB: MyObject(kind: kind, dataB: 2)
of kindC: MyObject(kind: kind, dataC1: 3, dataC2: 4)
result.dataAll1 = 10
result.dataAll2 = 20
result.dataAll3 = 30
Run
- Error: You must provide a compile-time value for the discrim... thefoxandflea
- Re: Error: You must provide a compile-time value for th... roel
- Re: Error: You must provide a compile-time value fo... thefoxandflea
- Re: Error: You must provide a compile-time valu... roel
- Re: Error: You must provide a compile-time ... jasper
- Re: Error: You must provide a compile-... thefoxandflea
