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

Proposal: DrRacket Surrogates for meta-languages #243

Closed
LeifAndersen opened this issue Dec 3, 2018 · 1 comment
Closed

Proposal: DrRacket Surrogates for meta-languages #243

LeifAndersen opened this issue Dec 3, 2018 · 1 comment

Comments

@LeifAndersen
Copy link
Member

BACKGROUND:

DrRacket uses a language's get-info function to set parameters such as
syntax coloring, indentation, and toolbar buttons. One parameter is
definitions-text-surrogate1, which lets #langs set a surrogate
for DrRacket. The docs mention that this is a powerful, yet easy to do
wrong, IDE extension mechanism.

Unfortunately, as is, the definitions-text-surrogate form does not
mix well with meta-languages e.g. s-exp, reader, at-exp. When given
the definitions-text-surrogate key, get-info returns a single module
path for DrRacket to dynamic-require. There is no way for a
meta-language to mix in its surrogate with the surrogate of the
language its extending. (At least not without either creating a
temporary file on the fly, or trying to scrape the current state of
DrRacket. Both of which are terrible ideas.)

PROPOSAL:

We extend the valid values for the definitions-text-surrogate key to
be a list of symbols as well as a single symbol. In the case of a
single symbol, nothing changes.

In the case of a list, each element must also be a module path. The
last element must refer to a module that provides a surrogate% class
as before. Every other element, however, refers to a module that
provides a surrogate% mixin. The IDE constructs the expected
surrogate by traversing the list, each time dynamic-requireing the
module, and mixing in the result. Meta-languages can augment existing
surrogates, rather than having to throw them away entirely. The
get-info code for a meta-language might look something like this:

(make-meta-reader
  ...
  (lambda (base-get-info)
    (lambda (key default)
      (case key
        [(definitions-text-surrogate) (flatten (list
"meta-surrogate.rkt" (base-get-info key default)))])))

ENGINEERING EFFORT:
It looks like all of the changes would be confined to the following files:
drracket/drracket/drracket/private/in-irl-namespace.rkt
drracket/drracket/drracket/private/insulated-read-language.rkt
drracket/drracket/drracket/private/module-language-tools.rkt

(Obviously also documentation+tests)

@LeifAndersen
Copy link
Member Author

Moved to #244

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