On Sun, July 2, 2017 19:15, Marco van de Voort wrote: > In our previous episode, Tomas Hajny said: >> > Worse, tying it to range check would then have heaps of redundant >> checking >> > everywhere, not just enums. >> >> True. That's why I believe that Read from a (typed) file should perform >> such validation - but it doesn't at the moment, as mentioned in my >> e-mail >> in the other thread. :-( > > That slows down needlessly IMHO. Or do you mean only in $R+?
$R+ would be sufficient from my point of view, but I'm not sure if that is possible, because $R+ is usually in effect in the place of declaration and the checks would probably need to happen inside the Read implementation (which is already compiled at that point in time). Unlike to $I, there's probably no way for $R to provide feedback to the caller which may be used for checks around the call. > Most will blockread records anyway. That's exactly the point. If someone uses BlockRead/BlockWrite for higher performance and thus uses untyped access, he/she has to perform manual checks as appropriate. If someone decides to use typed files, he/she probably prefers type safety over performance, but doesn't get either at the moment. :-( Tomas _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel