Hi Michael, On Sun, Mar 12, 2017 at 7:33 PM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:
> IMO, C# like getter/setter is better though. > > http://stackoverflow.com/questions/11159438/looking- > for-a-short-simple-example-of-getters-setters-in-c-sharp > I pasted wrong URL. This URL has better example code. https://msdn.microsoft.com/en-us/library/w86s7x04.aspx While DbC is nice, but checks are only performed on dev environment for maximum performance and acceptable safety. Therefore, developers must implement mandatory validations at trust boundaries to ensure software safety. i.e. Code correctness and security. Your proposal is useful for this. Please note that, with DbC, caller has responsibility to make correct calls that follow contracts. e.g. Caller must use sane parameters for callee. With this design, basic objects/functions, that may execute validation code repetitively, can safely omit validations for maximum performance as long as contracts are maintained. I'm not against to have method/feature that validates object, but it would be better to implement DbC support, then runtime object validation support. Otherwise, users would design poor performance objects that execute validation code repetitively. Regards, -- Yasuo Ohgaki yohg...@ohgaki.net