Hi!

I am trying to do the following:
    
    
    import tables, times
    
    type
      Person* = object
        name*: string
        birth_date_time*: DateTime
    
    proc newPerson(name: string,
                   birth_date_time: DateTime): Person =
      return Person(name: name,
                    birth_date_time: birth_date_time)
    
    var family = initTable[string, Person]()
    
    let papa = newPerson(name = "Udo",
                        birth_date_time = initDateTime(1, mJan, 1980, 12, 0, 0, 
0, utc()))
    family["Udo"] = papa
    let mama = newPerson(name = "Ida",
                        birth_date_time = initDateTime(15, mApr, 1981, 12, 0, 
0, 0, utc()))
    family["Ida"] = mama
    
    
    echo "Papa: " & family["Udo"].name & " - born: " & 
$family["Udo"].birth_date_time
    echo "Mama: " & family["Ida"].name & " - born: " & 
$family["Ida"].birth_date_time
    
    
    Run

It works but y get

`d:\Documents\Jobs\WTS\InvReporting\Prototype 
II\Research\DateTimeInTable\objects.nim(13, 23) template/generic instantiation 
of `initTable` from here 
C:\ProgramData\nim\lib\pure\collections\tables.nim(308, 12) Warning: Cannot 
prove that 'result' is initialized. This will become a compile time error in 
the future. [ProveInit] d:\Documents\Jobs\WTS\InvReporting\Prototype 
II\Research\DateTimeInTable\objects.nim(17, 7) template/generic instantiation 
of `[]=` from here C:\ProgramData\nim\lib\pure\collections\tableimpl.nim(49, 
12) template/generic instantiation of `enlarge` from here 
C:\ProgramData\nim\lib\pure\collections\tables.nim(269, 10) Warning: Cannot 
prove that 'n' is initialized. This will become a compile time error in the 
future. [ProveInit] CC: objects.nim Hint: [Link] Hint: operation successful 
(42006 lines compiled; 1.295 sec total; 58.184MiB peakmem; Debug Build) 
[SuccessX] Hint: "d:\Documents\Jobs\WTS\InvReporting\Prototype 
II\Research\DateTimeInTable\objects.exe" [Exec] Papa: Udo - born: 
1980-01-01T12:00:00Z Mama: Ida - born: 1981-04-15T12:00:00Z`

This warning seems to be linked to the usage of DateTime as part of the object 
properties (It does not show up if e.g. using a string to represent the 
birth_date_time).

Should I just ignore the warning, or better try a workaround?

Background: I am building a solution that controls timing of data provision and 
time series type changes. Thus, a lot of DateTime type information flying 
around. Would rather prefer not messing around with strings all the time. 

Reply via email to