Stream: helpdesk (published)

Topic: getproperty for a wrapper


view this post on Zulip Eric Forgy (Feb 04 2021 at 20:16):

Hi,

I have a wrapper type and I'd like to overwrite Base.getproperty so that A.x returns A.values.x, but I am using getproperty in getproperty and... stack overflow :boom:

Is there someway to do this?

view this post on Zulip Keith Rutkowski (Feb 04 2021 at 20:17):

This? getfield(A, :values).x

view this post on Zulip Eric Forgy (Feb 04 2021 at 20:18):

I'll try. Thanks :pray:

view this post on Zulip Mason Protter (Feb 04 2021 at 20:38):

getfield is basically the version of getproperty that can't be overloaded and always refers to the real fields of a struct. So usually, it's the thing that getproperty is implemented in terms of.

view this post on Zulip Eric Forgy (Feb 04 2021 at 20:40):

Got it. Thanks :pray:


Last updated: Oct 02 2023 at 04:34 UTC