API for storing and retrieving "private" data #195
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds an API that allows a consumer of Luerl to store private data that can be retrieved from functions called within Lua. This is useful in applications that may need to retrieve secrets from within Luerl, but don't want Lua scripts to be able to access these values.
I've chatted with a number of users of Luerl, including Sam Aaron, who have had the need to expose secrets into their Luerl programs. Some have achieved this by using closures to close over private data and expose those functions to Luerl. I have used the process dictionary to acheive the same thing.
If Luerl had an API to store and retrieve private data, as proposed by this PR, then both techniques would be unnecessary.
Alternative API
Provide a
update_private/2
function instead that takes a function that can modify the private mapTODO