RE: distinguishing getters and setters
"Jim Little" <[email protected]> Thu, 18 Sep 2003 11:57:49 -0700
| Newsgroups | gmane.comp.programming.tools.fit.devel |
|---|---|
| Message-ID | <[email protected]> |
From: Dave Thomas
> Perhaps better might be the spreadsheet conventions: a derived value
is
> preceded by an equals sign
>
>By extension, we could have
>
> a b =sum
I like this approach a lot. Very clear and readable. Does it work for
other examples?
SimpleExample:
numerator | denominator | =quotient
numerator | denominator | quotient?
1000 | 10 | 100.0000
CalculatorExample:
volts | =watts | =points
volts | watts? | points?
3.75 | .500 | false
MusicExample (RowFixture):
title | artist | album | year | =time | =track
title | artist | album | year | time? | track?
S. Woman | W. Report | M. Woman | 1974 | 3.70 | 2 of 7
Hmm... equals is better for the arithmetic examples, it's a wash for the
calculator example, and I like question mark better for the music
example.
I like '?' better overall because it makes it clear you're asking the
computer a question. But '=' works well and is more declarative, which
is more like Ward's approach. Both seem like good choices to me.
We could support both, but I'm not a big fan of TMTOWTDI ("there's more
than one way to do it", from Perl): I prefer DITWS ("do it this way,
stupid").
Jim