My class has a property that cannot be set in the constructor: a serial port handle that is opened in start(), and a lookup table that is expensive to compute and not always needed. I have seen both lateinit var port: SerialPort and val table by lazy { buildTable() } used for this kind of thing.
What are the actual differences and restrictions of the two, and what happens if the property is read too early?




