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

Tests / Filters #82

Open
sagotch opened this issue Feb 10, 2019 · 1 comment
Open

Tests / Filters #82

sagotch opened this issue Feb 10, 2019 · 1 comment

Comments

@sagotch
Copy link
Contributor

sagotch commented Feb 10, 2019

Here is a proposal:
Have a special tests collection in context or environment. In the case of a is test, we could look at this collection first, and look for a regular filter if you found nothing.

In this case, we could have something like this

  | TestOpExpr(target, IdentExpr test) -> jg_test env ctx test [value_of_expr env ctx target]
  | TestOpExpr(target, test) -> jg_apply (value_of_expr env ctx test) [value_of_expr env ctx target]

and jg_test env ctx test v =
  try (Hashtbl.find env.tests test) v
  with Not_found -> jg_apply  (jg_get_value ctx test) v

with some std_tests defined in Jg_runtime, but nothing hardcoded in Jg_interp. i.e. user could use its own implementation / add any tests he wants.

@sagotch
Copy link
Contributor Author

sagotch commented Feb 10, 2019

Another option would be to fail if nothing is found in tests (i.e. do not consider it as a regular application).

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

No branches or pull requests

1 participant