_This issue was originally filed by jesse.r...@gmail.com_
I can comment for days about the weakness of language extension features most programming languages have which increases coding while reducing readability. Here goes.
Please add custom library operator functions. Examples will make my point. See if you can read the code easily and how it better self documents/mirrors the logic without classes or Lambdas. Compare it to just using dirty functions.
// defined at top level in library
operator between(num low, num high);
operator in(List values);
//Sample usage
if ( customer.age between(18,65) ) {
print("Contact this customer about an insurance policy.");
}
if ( customer.status in(2,3,5) ) {
print("Customer is a VIP, treat him good.");
}
var state = "NJ";
if ( state in(states) ) {
//state is a valid US state in states list.
}
_This comment was originally written by [email protected]_
_Removed Type-Defect label._
_Added Type-Enhancement, Area-Language, Triaged labels._
I've renamed the issue so it actually conveys some meaning. As for the substance - we've stuck to a conventional syntax because most people are comfortable with it, not because we don't know of a better one. For example:
(customer age between: 18 and: 65) ifTrue:[print: "...."]
Anyway, we'll consider refinements to the syntax in due course.
_Set owner to @gbracha._
_Added Accepted label._
_Changed the title to: "Infix function syntax"._
Infix function syntax violates the simple conservative design principle for Dart.
_Added WontFix label._