:: Re: [Libbitcoin] v3 update
Etusivu
Poista viesti
Vastaa
Lähettäjä: Neill Miller
Päiväys:  
Vastaanottaja: Eric Voskuil
Kopio: libbitcoin
Aihe: Re: [Libbitcoin] v3 update
On Mon, Nov 07, 2016 at 02:25:31PM -0800, Eric Voskuil wrote:
> I've already inlined the interpreter and will soon inline the remaining utilities (operation, number, program). This will give the compiler to option to remove the call stack overhead during script processing, without losing the testability and readability benefits of well-factored code.
>
> Finally, recent changes now make it possible to run Bitcoin script as one would expect to run any program...
>
> // my program (false)
> operation::list ops
> {
>     { opcode::positive_2 },
>     { { 2 } },
>     { opcode::equal },
>     { opcode::not_ }
> };

>
> script foo(ops);
> program bar(foo, [environment]);
> auto result = bar.evaluate();
>
> If (result == error::success)
> {
>     // script completed
>     If (!program.stack_false())
>     {
>         // number 2 is not data 2
>     }
> }


Very cool, nice work!

-Neill.