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

Add basic quasi-quoting #3

Closed
wants to merge 3 commits into from
Closed

Add basic quasi-quoting #3

wants to merge 3 commits into from

Conversation

Mouq
Copy link
Contributor

@Mouq Mouq commented Jan 4, 2015

Not sure if this is the way quasi's were intended on being implemented, though it was pretty simple due to the infrastructure that had already been set up.

@masak
Copy link
Owner

masak commented Jan 4, 2015

Thank you! Looks very good.

I'll have to think about how we want quasis to stringify — that was the only non-obvious part of the pull request to me — but that's a minor thing, not blocking acceptance of this patch.

Rebased locally; closing this as accepted.

@masak masak closed this Jan 4, 2015
masak pushed a commit that referenced this pull request Mar 4, 2017
wip
Try doing this:

    $ bin/007 --backend=i13n examples/name.007

Should get this output:

        # static frame #1
        # call A from line zero: frame 2
        # static frame #3
        # call B from line zero: frame 4
     1. macro name(expr) {
            # static frame #5
            # call C from line zero: frame 6
     2.     if expr ~~ Q::Postfix::Property {
     3.         expr = expr.property;
     4.     }
            # static frame #7
            # call D from line zero: frame 8
     5.     if expr !~~ Q::Identifier {
     6.         throw new Exception {
     7.             message: "Cannot turn a " ~ type(expr) ~ " into a name"
     8.         };
     9.     }
            # static frame #9
            # call E from line zero: frame 10
            # call F from line zero: frame 11
    10.     return quasi { expr.name };
    11. }
    12.
    13. my info = {
    14.     foo: "Bond",
    15.     bar: {
    16.         baz: "James Bond"
    17.     },
    18. };
    19.
    20. say(name(info));           # info
    21. say(name(info.foo));       # foo
    22. say(name(info.bar.baz));   # baz
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