[fpc-pascal] Class field property access

Ryan Joseph genericptr at gmail.com
Fri Jun 7 21:27:16 CEST 2019



> On Jun 7, 2019, at 8:08 AM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> Only because this example appears safe does not mean that the whole concept is safe.
> A class might initialize b only later on and with a direct property you'll only get an access violation. So you'll need a getter anyway to provide a better exception type. Or to dynamically create the object instance. 
> 
> I see no reason to revert this change. 

Well, the consequence is that programmers that now know how to be safe are going to have to do more work by writing getters/setters. Pascal allows  potentially unsafe memory access in all other situations so I don’t see why properties are any different. We’re targeting the lowest common denominator instead of allowing careful programers to do their best.

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list