Re: Questions about CLOS
- From: Barry Fishman <barryfishman@xxxxxxxxxxxxxx>
- Date: Sun, 29 Jul 2007 14:45:13 GMT
Justin Paston-Cooper <defcon8@xxxxxxxxx> writes:
Hello. I'm trying to think of a way to implement interest rates on
bank accounts. Each time withdraw, credit or is called, I would like
it to be checked whether interest should be added to the account. Or
maybe another solution is better.
If one does direct slot accesses, I don't think there is any way of
doing it.
However, if an interest check was done as :before method of its
'balance' reader method, it seems to be sufficient.
I would think the correct interest accumulation is only needed
as a part of a some operation that checks the balance. Otherwise,
the operation is not dependent on it, and the fact that the instance
has not actually been updated is of no concern.
The only issue is that, there may some other slots in the account
instance that are dependent on the balance, and updated when the balance
is changed. Their reader methods might also need to do an interest
check.
This might cause a lot of interest checks, however, a simple check of
the date against a precomputed date of the next interest change
could be relatively inexpensive.
.
- Follow-Ups:
- Re: Questions about CLOS
- From: Ken Tilton
- Re: Questions about CLOS
- References:
- Questions about CLOS
- From: Justin Paston-Cooper
- Re: Questions about CLOS
- From: Rainer Joswig
- Re: Questions about CLOS
- From: Kent M Pitman
- Re: Questions about CLOS
- From: Justin Paston-Cooper
- Questions about CLOS
- Prev by Date: clisp screws my enviromnent
- Next by Date: Re: shootout: implementing an interpreter for a simple procedural language Minim
- Previous by thread: Re: Questions about CLOS
- Next by thread: Re: Questions about CLOS
- Index(es):
Relevant Pages
|