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

Symbols instead of keywords? #30

Closed
emiln opened this issue Sep 23, 2015 · 1 comment · Fixed by #31
Closed

Symbols instead of keywords? #30

emiln opened this issue Sep 23, 2015 · 1 comment · Fixed by #31

Comments

@emiln
Copy link
Owner

emiln commented Sep 23, 2015

I wonder if perhaps symbols would be easier for people to relate to for the EDN DSL. The current example in the README is

[:repeatedly
 [:if [:pointer-near 100 100 50]
  [:move-to 500 500]
  [:move-to 100 100]]
 [:repeat 100
  [:click]
  [:scroll-down 5]]
 [:when [:pointer-near 500 500 50]
  [:scroll-up]]
 [:wait 1000]]

but it could just as easily be

[repeatedly
 [if [pointer-near 100 100 50]
  [move-to 500 500]
  [move-to 100 100]]
 [repeat 100
  [click]
  [scroll-down 5]]
 [when [pointer-near 500 500 50]
  [scroll-up]]
 [wait 1000]]

or even

(repeatedly
 (if (pointer-near 100 100 50)
  (move-to 500 500)
  (move-to 100 100))
 (repeat 100
  (click)
  (scroll-down 5))
 (when (pointer-near 500 500 50)
  (scroll-up))
 (wait 1000))
@emiln
Copy link
Owner Author

emiln commented Sep 23, 2015

I'd suggest just dispatching on (comp name first), which will allow all of :click, click, and "click" to work. The choice of parentheses is already flexible and allows both styles.

emiln pushed a commit that referenced this issue Sep 23, 2015
Until now a command must start with a keyword. This has been relaxed
and a command can now start with a keyword, a symbol, or a string.

This means that all of the following are legal ways to represent a
click:

[click] [:click] ["click"] (click) (:click) ("click")
emiln pushed a commit that referenced this issue Sep 24, 2015
#30

Using a wrong command name will now produce an error message
including the names of all currently implemented commands. This is
fetched dynamically by inspecting the MultiFn and should always be
up to date.
emiln pushed a commit that referenced this issue Sep 24, 2015
#30

The function to look up functions contained in a multimethod has been
moved to a utils namespace and now sports a proper docstring.
@emiln emiln closed this as completed in #31 Sep 24, 2015
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 a pull request may close this issue.

1 participant