Delphi Haven – There was an interesting question on StackOverflow recently, asking whether it is possible to define a string type whose instances have a minimum and maximum length. More exactly, there was an interesting answer to that question, Andreas Rejbrand chipping in with a record-based solution that leverages operator overloading. While very stimulating, on reflection, I think there is the odd issue with it though. In particular, instances of the type should be explicitly created, but there’s nothing enforcing that, and the behaviour of the + operator defined is perhaps not very intuitive ...
Visits by Source
Users who voted for this posting