Stream: beginners

Topic: Lambda in record


view this post on Zulip Luke Boswell (Dec 14 2022 at 00:09):

Is it a bad idea to store a lamda in a record? I'm storing a function in a record, and then storing the record in a dict, and it's doing all kind of crazy things. If I change the size of another constant in the record from 16-32-64 bits it gets stranger. Varies from panics to segfaults to making other values in the record go crazy.

view this post on Zulip Luke Boswell (Dec 14 2022 at 00:10):

Just not sure if that is me doing the wrong thing. I feel like I should be able to store a lambda in a record.

view this post on Zulip Brendan Hansknecht (Dec 14 2022 at 00:36):

Yeah, you should be able to store lambdas in records

view this post on Zulip Brendan Hansknecht (Dec 14 2022 at 00:37):

How are you testing that the values are going crazy?

view this post on Zulip Luke Boswell (Dec 14 2022 at 00:58):

I'm using dbg to inspect the state of the dict. I can share my code later.

view this post on Zulip Brendan Hansknecht (Dec 14 2022 at 01:08):

There is a pretty decent chance that the issue is with dbg and not with the record going crazy

view this post on Zulip Brendan Hansknecht (Dec 14 2022 at 01:08):

I have seen debug print totally incorrect results with dictionaries

view this post on Zulip Brendan Hansknecht (Dec 14 2022 at 01:08):

and records in general

view this post on Zulip Brendan Hansknecht (Dec 14 2022 at 01:09):

But if I take a field, convert it to str, and then debug print, it will be the normal value that I expect

view this post on Zulip Brendan Hansknecht (Dec 14 2022 at 01:09):

I think debug may have some bugs where it decodes wrong.

view this post on Zulip Brendan Hansknecht (Dec 14 2022 at 01:09):

Definitely worth filing issues so we can try and fix this.


Last updated: Jul 06 2025 at 12:14 UTC