|
From: Robert S. <rm...@un...> - 2026-06-09 15:18:13
|
On Mo, 2026-06-08 at 22:09 +0200, Bertho Stultiens wrote: > > Another approach that would be possible in principle with accessors > > would be to do conversion between types in the setter/getter > > functions. > > That is exactly the idea. If you change the underlying model, then > the > code does not need adjusting because the getter/setter code will > capture > and adapt to the changes so your API is a constant. > > > > The disadvantage would be that this could lead to surprising > > behaviour > > and you can't explicitely decide if you want to truncate, saturate, > > round or whatever to convert a value. > > FWIW, the current code assumes truncation nearly everywhere. > Otherwise > it codes around the problem (or crashes if the programmer didn't care > to > take account for it). I was talking more about the user experience and the possibility to avoid conv_X_Y functions, with accessors, linking different numerical types could be possible, e.g. connect a bit output to a int input. -- Robert Schöftner <rm...@un...> |