Open Stebalien opened 7 years ago
We can't know what it returns though. It can return literally anything.
It can't, e.g., return a peer.ID
, can it? That is, I assume it can only return primitives. The problem is that it's unclear what primitives it can return. See the example in the issue body; CBOR, e.g., encodes integers as varints but nothing indicates if go-ipld-cbor
can return int
, int32
, int64
, BigInt
, float32
, or all of the above.
Basically, we need consistent set of primitive types.
No, it could totally return a peer.ID, or a ProtoNode, or an ethereum transaction, or anything else really
On Fri, Sep 1, 2017, 5:28 PM Steven Allen notifications@github.com wrote:
It can't, e.g., return a peer.ID, can it? That is, I assume it can only return primitives. The problem is that it's unclear what primitives it can return. See the example in the issue body; CBOR, e.g., encodes integers as varints but nothing indicates if go-ipld-cbor can return int, int32, int64, BigInt, float32, or all of the above.
Basically, we need consistent set of primitive types.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ipfs/go-ipld-format/issues/25#issuecomment-326709509, or mute the thread https://github.com/notifications/unsubscribe-auth/ABL4HIVn6qh0jL4rhCb-u6g9-7bsM9OSks5seKEVgaJpZM4O68HN .
CBOR also can encode either floating point or normal integers.
For example, let's say that I'm expecting a number. Should I try casting to a uint64?, float?, etc. We should either provide "canonical" types aliases:
Or return a custom type: