ipld / js-block

IPLD Block Interface
6 stars 3 forks source link

Move encode/decode to sync functions #1

Closed mikeal closed 5 years ago

mikeal commented 5 years ago

As I’m implementing the type system I’m stepping all over this limitation.

At this point, the get-codec interface is sync in the browser and in Node.js so the async API surface of .encode() and .decode() is entirely future proofing.

The problem I’m having in the type system is that I need to get information out of the block in the constructor of several classes and I can’t do that because constructors aren’t async.

Any objections @vmx?

vmx commented 5 years ago

That's fine with me. I see us still in the prototyping/experimental phase. So keeping things simple makes sense.