PROPOSAL: String parameters compile time validation (early beta) (original) (raw)
Artur Biesiadowski abies at adres.pl
Thu Mar 26 14:19:56 PDT 2009
- Previous message: PROPOSAL: String parameters compile time validation (early beta)
- Next message: PROPOSAL: String parameters compile time validation (early beta)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Marek KozieĊ wrote:
Validation by regexp-s would be only at compile time (efficiency).
Target is quite clear, but anyone see any problems?
As somebody else said, it might be a part of the JSR 305. But just to give you example complications:
can (a{1-3}) be passed to (a+) ? (a|b) passed to (b|a) ? [0-9][a-z] passed to [:digit:][:letter:] ?
It might be a nice project for somebody's thesis to work on equivalence/superset/subset relationships between regexp (especially fun if you take backreferences into account), but I would not put it into java type system...
And no, validation only on compile time doesn't make any sense. You would need some kind of cast operator on regexp, which would cast free-form string into regexp-bound string (and throw exception otherwise) - similar to way Class.cast works.
Regards, Artur Biesiadowski
- Previous message: PROPOSAL: String parameters compile time validation (early beta)
- Next message: PROPOSAL: String parameters compile time validation (early beta)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]