[Seaside] [Bug][Fix] WADateSelector

Ramon Leon rleon at insario.com
Thu Jul 7 23:32:35 CEST 2005


> How about an approach taking advantage of Smalltalk idiom?
> 
> privateIsValidDay: theDay monthNumber: theMonth year: theYear
> 
>     ^(theMonth between: 1 and: 12)
>         and: [theDay between: 1 and: (Month daysInMonth: theMonth
> forYear: theYear)]
> 
> Note:  I hate creating temporary variables unnecessarily!
> 
> The implementation of #between:and: in both Squeak and 
> VisualWorks is this:
> 
> between: min and: max
>     ^self >= min and: [self <= max]
> _______________________________________________

Even nicer, but how about a little cleaner, though could just be my
personal pet peeves about using "the" instead of "a" for arguments, and
not encoding the type into the selector, but into the argument instead,
if it's necessary, but I totally agree about avoiding temps.

isValidDay: aDayNum month: aMonthNum year: aYearNum
    ^(aMonthNum between: 1 and: 12)
        and: [aDayNum between: 1 
            and: (Month daysInMonth: aMonthNum forYear: aYearNum)]


More information about the Seaside mailing list