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

semicolon support #5

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

semicolon support #5

wants to merge 1 commit into from

Conversation

isaeken
Copy link
Contributor

@isaeken isaeken commented May 26, 2022

now we can use like

func(a+b);
5 + 5;
"hello world";

the evalute method returns when semicolon exists: [(func result), 10, "hello world"]

@leongrdic
Copy link
Owner

i like the idea of support for multiple expressions, it would make SMPL a little bit closer to an actual programming language :)
but returning all expressions results in an array doesn't seem very useful imho.

what do you think about behavior similar to Ruby's where the last expression's result is returned?

@isaeken
Copy link
Contributor Author

isaeken commented May 29, 2022

we can add return instead and no data such as void will be returned unless return is used.

@leongrdic
Copy link
Owner

let me elaborate on this:

take a look at the following project that depends on SMPLang: https://github.com/leongrdic/php-dataplater

SMPLang should continue supporting single-expression execution without the return statement, which is why I am considering the Ruby approach.
also, multiple expression support doesn't seem very useful without a way to set var values within the language.

i think implementing all of this at this stage is a lot of work and even then i'm not sure it'd be worth the effort.

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