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

extension support & some extensions #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

isaeken
Copy link
Contributor

@isaeken isaeken commented May 26, 2022

No description provided.

@leongrdic
Copy link
Owner

leongrdic commented May 26, 2022

thank you again for your contributions!

what do you think about making extensions optional for each object? we could also allow users to make their own extensions and load them when needed.

i'm not really sure that the unset() function is a good idea for now.
first of all, changing a var's value is currently not possible in SMPL - we could at some point introduce a syntax for settings a var value (e.g. a = 1) but that on its own wouldn't make sense without support for executing multiple expressions at once because currently each execution of evaluate() has its own isolated state (which is by design).

besides that, the isset() function wouldn't work properly for var.element or var['element'] which is something that should work if we provide a builtin isset() function. what we could do is evaluate the first parameter passed to the function and if any value comes out, it returns true, but if a var not defined exception occurs it catches it and returns false instead. the problem with this approach is that isset('some string') would return true, and that doesn't seem to be good (php throws a fatal error if you try to do that).

all in all, i'm not sure if we should have any builtin state-changing functions.

i definitely appreciate your efforts very much but let's discuss this before you write more code, I want to hear your opinions!

p.s. if you haven't already, take a peak at Dataplater - another project of mine that uses SMPL

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.

2 participants