[Top][All Lists]

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

Re: [Taler] statically typed wallet, wrapper functions

From: Christian Grothoff
Subject: Re: [Taler] statically typed wallet, wrapper functions
Date: Mon, 14 Dec 2015 10:06:27 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

Anything that reduces the amount of code and eliminates certain errors
by providing better type checking at the same time, is great.


On 12/14/2015 05:27 AM, Florian Dold wrote:
> We could do something like this (not implemented):
> class WithdrawRequestPS implements SignatureStruct {
>   get fieldTypes () {
>     return [
>        ["reserve_pub", ReservePublicKey],
>        ["amount_with_fee", Amount],
>        ["withdraw_fee", Amount],
>        ["h_denomination_pub", HashCode],
>        ["h_coin_envelope", HashCode]];
>   }
> }
> which saves us from
> 1. Having the wrapper function
> 2. Type-errors when calling the wrapper function.  In the example above,
> everything is typed and named.  We only have to get all fields and their
> order right *once*.
> You'd use it like this:
> let x = new WithdrawRequestPS({reserve_pub: bla, ...});
> We'd automatically have the binary representation when all members are
> either PackedArenaObjects or some other type that provides us the
> necessary info.
> We'd also have an automatic JSON serialization of the withdraw request,
> with is convenient for the database.
> Opinions?

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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