motoko icon indicating copy to clipboard operation
motoko copied to clipboard

Expose IDL serialisation as primitives

Open ggreif opened this issue 5 years ago • 3 comments

serialize : T -> Blob deserialise : Blob -> (ex T)

Not sure if these are really a net win, but we discussed this when wondering why testing is currently slow (drun).

How to create existential packages for deserialise, is also not clear, since we have no type reflection.

ggreif avatar Feb 04 '20 16:02 ggreif

We'd be facing the same problems as for debug_show, so the best thing we can do right now, I think, is add these as their own AST form. I would not mind them. Maybe prefaced with debug_. Doesn’t scale in the long run.

Also, the types will change once we have references (for the reference array).

nomeata avatar Feb 04 '20 16:02 nomeata

Related:

  • c6e0ea6df62c3d94f1cadb02a48a6b9f6d7a36ab (exposing this as prim …)
  • https://github.com/dfinity-lab/motoko/issues/1655 (thoughts about how to expose this as functions)
  • the discussion around non-parametric polymorphism (no issue yet, I think)

nomeata avatar Nov 23 '20 11:11 nomeata

We now have to_candid and from_candid, can this be closed? @crusso?

ggreif avatar Mar 26 '25 13:03 ggreif