>  Can we put this into the relevant repo (drracket) please?

Yup. I've opened a issue in the DrRacket repo, and am working on a PR now.

>  I think Robby gave you the go-ahead.

That's the impression I got too.

> Except for the fact that the definitions-text-surrogate was kind of dubious 
> to begin with, this sounds like a good idea to me!

Ha...ya...that it is. Hopefully we can eventually make something
similar in power, but safer soon. ;)

On 12/2/18, Matthias Felleisen <[email protected]> wrote:
>
> Can we put this into the relevant repo (drracket) please?
>
> I think Robby gave you the go-ahead. — Matthias
>
>
>
>
>
>> On Dec 1, 2018, at 11:50 PM, Leif Andersen <[email protected]> wrote:
>>
>> 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-surrogate`[1], which lets `#lang`s 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-require`ing 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)
>>
>> [1]:
>> http://docs.racket-lang.org/tools/lang-languages-customization.html?q=Definitions%20Text%20Surrogate#%28part._sec~3adefinitions-text-surrogate%29
>>
>> --
>> ~Leif Andersen
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-dev/CAAVaeECiQhKiziKVp6wOOWm6vQM1GPr90yPAOHoyOHDBJ3c62g%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>


-- 
~Leif Andersen

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAAVaeEA5RyKR2oTeSLijfgowJ0XWCA4CZ_bcqkNhdpzhCSzN1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to