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

Dominant Macros #6

Closed
marcioAlmada opened this issue Nov 2, 2015 · 1 comment
Closed

Dominant Macros #6

marcioAlmada opened this issue Nov 2, 2015 · 1 comment

Comments

@marcioAlmada
Copy link
Owner

Currently, by default, a macro backtracks if it's pattern is not fulfilled. But in many cases it would be useful to prevent backtracking after a given entry point is reached.

The idea is to use a single · (middle dot) to denote a "point of no return" in a macro pattern, as in:

macro {
    unless · (···expression) {
        ···body
    }
} >> {
    if (! (···expression)) {
        ···body
    }
}

So any wrong usage of the macro after the arbitrary entry point would throw some variant of syntax error:

unless ($x === 1);
// Unexpected ';' on line 1, expected '{'

I'm still unsure if this is a reasonable way to implement dominant macros. Maybe "dominant" should be the default behavior and a tag to allow backtracking (macro ·allow_backtrack {...} >> {...}) could be a better option.

@marcioAlmada marcioAlmada mentioned this issue Nov 2, 2015
40 tasks
marcioAlmada added a commit that referenced this issue Jan 26, 2016
@marcioAlmada
Copy link
Owner Author

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