lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] InputSequence questions


From: Greg Chicares
Subject: Re: [lmi] InputSequence questions
Date: Tue, 23 Mar 2010 21:22:10 +0000
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

On 2010-03-23 17:31Z, Vaclav Slavik wrote:
> 
> I didn't realize it until now, but I'm unclear about some properties of
> InputSequences that significantly affect editor's UI design:

Indeed we have overloaded emptiness...but in a reasonable way.

> * Does the sequence always cover the whole domain? In other words, does
>   the first interval always begin at 0 and the last end with maturity
>   (excl)? Or are discontinuous InputSequence values valid?

Discontinuous input is accepted; the value for an element of vector<T>
is T() where not explicitly specified otherwise.

For example, for issue age 45 and retirement age 65, a payment of
  1000 [5,retirement); 123 address@hidden, @72); 0
is realized as
     0 in [ 0,  5)  *** implicitly zero
  1000 in [ 5, 20)
     0 in [20, 25)  *** implicitly zero
   123 in [25, 27)
     0 in [27, 55)
(I typed intervals in manually, so there may be off-by-one errors.)

To the end user, that makes sense:
 --What do you want to pay?
 --$1000, starting five years hence and continuing to retirement; and
     $123 from age seventy through seventy-one.
They implicitly mean "$0 where I don't say otherwise".

I haven't given a lot of thought to what an input-sequence editor
should show in such a case, but I think showing every interval would
be best. In the example above, I may want to change the amount paid
in [0,5); if every interval is shown, then there's a textcontrol where
I can just type the new nonzero amount. (Otherwise, what would I do?
"Show hidden intervals"?)

BTW, for an enumerative type like payment mode, T() might be "annual".
For numeric types, I think it's always zero; but I know it's always T().

> * Does a [x, retirement] interval -- as opposed to [x, retirement) --
>   make sense?

Not really. If you want to pay premiums while you're not retired, and
pay nothing while you're retired, you want [0, retirement). Nobody
wants to pay something in the first year of their retirement only.

OTOH, it's not invalid. The sentence
  Isn't that the banjo player's Porsche?
is said never to have been spoken in English because playing that
instrument is generally not very remunerative, but a word processor
shouldn't forbid you to type it.

But OTTH I think an input-sequence editor could require half-open
[) intervals and forbid any other kind { [] (] () }. (Any other kind
of interval has a [) equivalent because endpoints are integral.)

Half-open [) intervals in index origin zero are the fundamental paradigm,
at least to me. The 'retirement' keyword is a case where that paradigm
just does the right thing for users who think in origin one and don't
consciously think about the openness of intervals. Another case is
  1000, 10; 0
where they mean "one thousand for ten years only"; they certainly
aren't thinking [0, 9).

> (I assume that "maturity]" doesn't, please correct me 
>   if I'm wrong.)

That would be detected as an error. Changing the example above to this:
  1000 [5,retirement); 123 address@hidden, @72); 0 address@hidden, maturity]
produces:

  Input validation problems for '':
  Interval [ 30, 56 ) is improper: it ends after the last possible
  duration. Current token 'end of input' at position -1.
  [file /lmi/src/lmi/input_realization.cpp, line 325]

although, regrettably, only when you "run" it, e.g. with "Census | Run...".
Validation should occur sooner, but doesn't because I never did the work
to make that happen. IIRC, I neglected that because every input-sequence
field would have to be revalidated whenever the state of the Input object
changes in certain ways--changing the age, for example. (There's a sketch
of some ideas in
  Input::TransferWithdrawalInputSequenceToSimpleControls()
which is probably not worth looking at except to appreciate that there is
some actual complexity. It's dead code that once did something that was
somewhat useful in a legacy non-wx system.)

> I'd like to confirm my interpretation of duration_mode, too. Is the
> following correct and complete?

In general, I think almost any of these enumerators can be used to specify
either the beginning or the end of an interval, except for these which I'll
answer in a different order than you asked:

> e_inception        - only begin_mode of the 1st interval?
> e_maturity         - maturity

which are always the earliest (inception) and the latest (maturity)
possible points: thus, "forever" means [e_inception, e_maturity).
So yes, e_inception is the begin_mode of the first interval, and
e_maturity is the end_mode of the last interval, and I believe any
other use should trigger a diagnostic. A GUI input-sequence editor
might have row of [begin, end) comboboxes in which e_inception is
permitted only in the first row's '[begin' box and e_maturity only
in the last row's 'end)' box.

> e_invalid_mode     - not valid for editing

That's nothing but a deliberately-invalid initial value, used when
we need to initialize a variable before we know what value to give it.
It should always be trapped, eliciting a runtime diagnostic. But that's
all just internal to class InputSequence; you should never see it for
editing, so you shouldn't have to worry about it at all.

> e_attained_age     - "until the anniversary of N years"

I'd omit the word "until", which to me suggests whether an interval
includes an endpoint; this just quantifies an endpoint without saying
whether or not it's included. But yes, it's the Nth anniversary, N
years after the "issue date"; thus, it equals duration minus issue age.

> e_number_of_years  - "for N years", is this end_mode only?

No--I'd omit the word "for", which suggests that this is a right-hand
endpoint; this just quantifies an endpoint. AFAICS these have the
same meaning in the example above (issue age 45, retirement age 65):
  1000 [5,retirement); 123 address@hidden, @72); 0 address@hidden, maturity)
  1000 [#5,retirement); 123 [#5, @72); 0 address@hidden, maturity)
A number without '#' means a duration--the number of full years
elapsed since inception. A number with '#' means the number of full
years elapsed since the beginning of the preceding interval. The
first '#5' above would normally be written '5' because 5+0 simplifies
to 5. The second '#5', in subexpression '123 [#5, @72);', would mean
"from five years after retirement up to but excluding age 72".

Such usage is even somewhat plausible. You might want to retire,
then live off your bank account for five years, then start taking
systematic cash withdrawals from your life insurance. The advantage
of specifying it that way is that end users can change the intended
retirement duration, and the input sequence will be reinterpreted
accordingly. If you retire at 55, then waiting five years before
beginning cash withdrawals is different from waiting to age 70,
and the little language allows both ways to be expressed.

> e_retirement       - retirement

Yes.

> I don't understand e_duration (and it's difference from
> e_number_of_years)

See above.

> or e_inforce, but as far as I can tell, the latter
> isn't implemented and can be ignored for now (?).

Yes.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]