Motoko: debug_show overload

Is there a way to overload what is run for debug_show in motoko? We have an object with a member property that has a circular loop and it causes a stack overflow when trying to show it. We’d like to intercept and iterate only once through the object or skip it altogether.

1 Like

AFAIK solutions have been explored for this type of thing (see below) but there isn’t a way to do it at the moment.

A long time ago I implemented similar things in userspace for showing, comparing, ordering, etc in Motoko but I don’t think the code is public.

I’ll follow up here with an example.

1 Like