4
votes
Vote UpVote

Bounded strings using ‘advanced’ records

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 ...
Favorite? Off-Topic? Chris Rolliston @ 2011-12-06 08:11

Statistics

Visits: 966
Votes: 4
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Daniele Teti
Jeroen Pluimers
Leif Uneus
Wouter
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)