Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6628249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:06:30+00:00 2026-05-25T22:06:30+00:00

I writing a DSL that executes as a Script ; it has various classes

  • 0

I writing a DSL that executes as a Script; it has various classes for various bits of syntax. e.g., for the “foo” keyword that takes a closure, I have a FooSyntax class and evaluate the closure “with” an instance of that syntax. This works fine, e.g.

bar = thing {} // make a thing 
baz = foo {
    mykeyword bar
}

passes the thing called bar to an invocation of FooSyntax#mykeyword.

I’m trying to add some better error messages for when there is an unknown variable reference. This manifests as a MissingPropertyException so my current approach is to add a propertyMissing method to FooSyntax. This works indeed for variables that are missing.

Unfortunately, it breaks the example above: bar becomes a missing property instead of falling through to the Binding. Why does adding a propertyMissing cause the Binding not to be consulted? (Does this have to do with the Closure‘s resolve strategy?) How can I fix this?

You can play with this with a sample script at https://gist.github.com/1237768

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:06:31+00:00Added an answer on May 25, 2026 at 10:06 pm

    I shall delegate my answer to the gist on which I commented. Basically, you should not be using the with() method to execute the closure against the FooSyntax delegate. For future reference, the standard approach is:

    def foo(Closure cl) {
        def f = new FooSyntax()
        def c = cl.clone()
        c.delegate = f
        c.call()
    }
    

    You can fine tune the behaviour by changing the resolution strategy on the closure like so:

    c.resolveStrategy = Closure.DELEGATE_FIRST
    

    but in this case you want the default Closure.OWNER_FIRST to ensure the binding is queried first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a DSL in Ruby to control an Arduino project I'm working on;
I'm writing a DSL where the + operator is strictly numeric, like some other
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the
Writing a test app to emulate PIO lines, I have a very simple Python/Tk
Writing documentation in html requires some code examples. What to do with characters that
I am thinking of writing a DSL to be run in the .Net environment.
I'm writing an F# dsl for SQL ( http://github.com/kolosy/furious ). A select statement would
I am writing a major-mode in emacs for a DSL I've created. I'm inheriting
Writing a sound control applet with GUI that communicates with a device via USB.
I a writing a DSL to generate parsers for bioinformatics flat files. I would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.