Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #784 Anonymous column calculator bug #786

Merged

Conversation

joneit
Copy link
Contributor

@joneit joneit commented Dec 5, 2018

Resolution

This PR (specifically 1727b44) fixes the bug reported in Issue #784.

This issue was with the column.calculator property overload where the value is a stringified anonymous function (use case 2 below).

calculator setter overloads

The calculator property setter is overloaded for any of the following use cases:

  1. Registered function name
    • Function is dereferenced from the calculators registry
  2. Anonymous stringified function
    • The string is functionified (inflated into an actual function object)
    • The function is registered (if not already in the registry) using the entire function string as the registry key
    • Registering the function normalizes other references to it, i.e., other references to the identical function string will not be individually functionified but will use the function in the registry
  3. Named stringified function
    • The string is functionified
    • The function is registered (if not already in the registry) using the function name as the registry key
    • Registering the function normalizes other references to it, i.e., referenced either with a function string using the same name (the first such function definition is the one that is registered) or simply by name (use case 1 above)
  4. Actual function object
    • The function object is stringified and then treated as use case 2 or 3 above as the case may be.
    • Note that this process strips the function of its execution context, which would be lost anyway when state is persisted (serialized). For a work-around if context is needed, see how to make dependency injection work with column calculator #785. If you use this work-around, you cannot persist your function with its context and you will need to programmatically recreate it whenever state is reloaded from persistent storage.

@joneit joneit changed the base branch from master to develop December 5, 2018 15:56
@joneit joneit merged commit 8a83e32 into fin-hypergrid:develop May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant