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

feat: add support for nested if and foreach #960

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from
Draft

Conversation

matteo-cristino
Copy link
Collaborator

@matteo-cristino matteo-cristino commented Nov 9, 2024

⚠️ This PR contains some breaking changes ⚠️

🚧 breaking changes:

  • EndIf now closes only the last opened branching
  • Error inside a If branch correctly propagate, only failing assertion in the if condition are captured and add to the stack
  • Multiple Foreach now does not run anymore in parallel (zip), but as nested foreach

✨ major features:

  • nested if and foreach
  • garbage collection done only when exceeding a memory limit, it ca be set from config with maxmem (default 1GB)

…d a single if

A small improvement have been done also since now after the first failing if the following one are no more executed
@matteo-cristino matteo-cristino added SKIP_JS Add this label to PR for skip JS checks in CI SKIP_RUST Add this label to PR for skip RUST checks in CI SKIP_PY Add this label to PR for skip PY checks in CI SKIP_GO Add this label to PR for skip GO checks in CI labels Nov 9, 2024
@matteo-cristino matteo-cristino marked this pull request as draft November 9, 2024 09:52
@matteo-cristino matteo-cristino linked an issue Nov 9, 2024 that may be closed by this pull request
@matteo-cristino matteo-cristino changed the title feat: support nested if separated by other statements and a way to end a single if feat: add support for nested if and foreach and a way to end a single if Nov 13, 2024
@matteo-cristino matteo-cristino changed the title feat: add support for nested if and foreach and a way to end a single if feat: add support for nested if and foreach Nov 14, 2024
…he if condition will not make the contract to fail

fix also some more transitions
…se list, prime numbers, factorial)

this can maybe serve as docs if we want to have a page in the docs where we challenge people with zencode exercises
matteo-cristino and others added 10 commits November 17, 2024 19:29
checks are done only on the first loop and store some more data in iter object to avoid some calculations at each step
unfortunately this do not improve performance, but anyway code is cleaner for sure
…ll to garbage collector (#969)

* refactor: try to improve performance

* ITER stack built at parse time
* avoid string/regexp checks in manage functions by doing it in the parse part and just do a lookup in the latter
* run manage functions only when needed

* feat: on zencode run perform garbage collection only if memory being used is more than MAXMEM

MAXMEM default value is 1024MB, but can be changed using the maxmem conf

* fix: typo in default value of maxmem

* docs: update config page

remove some old and not anymore present config and add scope and maxmem, try also to improve description of other config.
* docs: add foreach to zenroom documentation

* docs(foreach): rename some section title and add section on how to create the material in this page

* docs(if): exlpain the new way in which the if and endif work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SKIP_GO Add this label to PR for skip GO checks in CI SKIP_JS Add this label to PR for skip JS checks in CI SKIP_PY Add this label to PR for skip PY checks in CI SKIP_RUST Add this label to PR for skip RUST checks in CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Closing if branches
1 participant