I'm not sure I'm quite getting this. Is the idea that, if there is a #lang line present, DrRacket would always use that language. If there is no #lang line present, then DrRacket would use some other language, based on what was recently chosen in the language dialog?
Robby On Wed, Mar 21, 2012 at 10:47 AM, Neil Van Dyke <n...@neilvandyke.org> wrote: > How about a change to the purpose of the Languages control? > > Currently, I think of the control *selecting how to determine* which > language to use. Example settings "whatever #lang says", "Beginning > Student", etc. > > The control could be changed to *present the determination* (by #lang or by > some default), and only secondarily as a means to *change the determination* > (which might mean automatically changing the #lang in the file). The list > of override alternatives would be something like the languages that this > DrRacket instance knows about. There would not be a "whatever #lang says" > alternative, since that behavior is always the case. > > For determining the language when no #lang is present (such as when opening > a file without a #lang, or when creating a new file), the default could be a > preference setting, with alternatives like "Guess", "beginning-student", > "advanced-student", "racket", "racket/base"... and whatever other languages > this DrRacket knows. Default alternative would be "Guess", which I suspect > will work fine for most people. > > The "Guess" alternative in this preference could be some heuristics like > Emacs and the "file" command use (later on we could make these heuristics > extensible by packages that implement languages), and default to the last > #lang used. I suspect last-#lang-used would be fine, and any heuristics are > a bonus. (The heuristics might determine language of the file as distinct > from #lang languages, and for each file language, keep track of a > last-#lang-used. So, a heuristic might recognize Scheme as the file's > language, and then Guess would go and find what #lang the user last used for > a Scheme file. Again, last-#lang-used, with no heuristics, is fine 95%+ of > the time; heuristics are mostly for delighting the user with DrRacket's > cleverness the other 5% of the time.) > > Robby's suggestion of *always* requiring #lang is tempting, and I am close > to that, except that it would be nice to support languages that don't > syntactically permit #lang. For example, if we wanted to load up > JavaScript, XML, HTML, or Java files in DrRacket. > > Neil V. > > -- > http://www.neilvandyke.org/ > > > _________________________ > Racket Developers list: > http://lists.racket-lang.org/dev _________________________ Racket Developers list: http://lists.racket-lang.org/dev