Skip to content

self-bound delegates CTD. #2918

Closed
Closed
@mlheur

Description

I'm building a set of libraries, trying to mimic some OOP concepts, and predictably crashing to desktop when accessing delegates in certain ways e.g. printing the object that contains the self-bound delegate.

@LAZYGLOBAL OFF.
// instantiate the object
local the_object is lex("state", "some state").
// define the member function
local function show_state {parameter self.print "self state: "+self:state.}.
// add the member function to the object instance.
the_object:add("show_state",show_state@:bind(the_object)).
// use the member function.
the_object:show_state().
wait until false. // comment this line to crash your program.
print the_object.  // CTD for accessing a self-bound member.
// maybe due to infinite recursion following the member looping back to the parent.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions