Question on new Racket install graphic IDE

Why in the code below getting "read-syntax: #lang not enabled"

In the graphic IDE I get:

"Welcome to DrRacket, version 8.3 [cs].
Language: Advanced Student; memory limit: 128 MB.
read-syntax: #lang not enabled
possible reason: not allowed again inside a module that already starts #lang, or not enabled for interactive evaluation

"

#lang racket/base
(require racket/class)

(define fibber%
(class object%
(init-field n)
(define/public (get-value)
(cond
[(= n 0) 0]
[(= n 1) 1]
[else (+ (send (new fibber% [n (- n 1)]) get-value)
(send (new fibber% [n (- n 2)]) get-value))]))
(super-new)))

(send (new fibber% [n 30]) get-value)

1 Like

I believe your DrRacket is set to Language: Advanced Student; as shown by the text in the interactions window. You should be able to use the menu Language > Choose Language... to open a dialog and in that dialog you can select The Racket Language.

When certain languages are selected via this menu the #lang line may not be supported/active for that language. (Although I think quite a lot of student languages can be used via a #lang line as well, from what I have read, it seems that in the past that wasn't always possible for every language, which is why there is an explicit language switcher instead of every language using the #lang line.)
My knowledge about student languages is very limited, so others may have more to say about that.

1 Like

Using Beginning Student Language shows:

Welcome to DrRacket, version 8.3 [cs].
Language: Beginning Student; memory limit: 128 MB.
read-syntax: #lang not enabled
** possible reason: not allowed again inside a module that already starts #lang, or not enabled for interactive evaluation**
>

I am unsure what you are trying to do. What is your goal?
If you want to get started learning racket using the student languages, you can take a look at How to Design Programs which uses these student languages and programs written in them to get you started with learning the language.

The student languages are smaller languages used for teaching that are able to provide better error messages for the student.
But you can't use those languages to run a #lang racket/base racket program.
#lang racket/base is for when you already have learned racket, it is the more complex real world general racket language, it is only recommended to use that when you already know how to use it, or maybe in combination with other tutorials.

1 Like

If you just want to run your program you have to use The Racket Language (ctl-R) and press the OK button.

LanguageChooserDialog

1 Like

#lang racket/base entered in the IDE with this error which means I can't use any urlang. Why does this IDE won't use "#lang" to change a different dialect? I am sure there is some easy problem. None of the #lang dialects don't work with beginning and advanced.

Welcome to DrRacket, version 8.3 [cs].
Language: Beginning Student; memory limit: 128 MB.
read-syntax: #lang not enabled
possible reason: not allowed again inside a module that already starts #lang, or not enabled for interactive evaluation

Did you read Simon's replies? He already gave you a solution.

Yes, I think that joekillian should be able to solve their problem with the help of simonls's answers.

On the other hand, I can totally understand how it can be confusing to have these two language "levels" in the DrRacket GUI vs. as #lang line. I think it isn't far-fetched to assume that using #lang would be enough to choose a language (even though it obviously isn't enough).

Why do we have these two levels? Why are they necessary? Are they actually necessary or could DrRacket be changed to switch to "normal" Racket if #lang racket is used? But maybe that had already been considered and the current behavior been kept for a reason? If yes, which reason(s)?

(@all) Sorry for the many questions. Just answer what you want to answer and ignore the rest. :slight_smile:

I think the simple technical answer might be, every lang can be implemented with its own parser, many of which may not want to support the #lang. But that answer is a bit too simple, because the #lang line is quite easy to parse so drracket could detect that relatively easy.

I suspect those two different ways of selecting language is more a historical artifact, because some drracket functionality didn't work via #lang line (I remember reading relatively recent mailing list posts about some feature that was made to work that didn't work before, if I remember correctly it was something about language specific tool-buttons).
Apart from that I don't know whether there is still a strong argument for having more than the #lang line.

Personally I am not bothered by it either way, but maybe it could make sense to add a #lang line detection feature to drracket? The idea would be if some non-#lang language is selected and a #lang line is detected, some sort of note could popup asking you if you want to switch modes.
But implementing something like this would only make sense if this is a common problem and maybe there are other better solutions.

I also am curious about your other questions, overall I think it is mostly a matter of finding a good way to improve it and doing the work of improving it.
DrRacket seems to be used by a lot of different small groups so having that language switcher probably made it easier for those groups to switch to their way of using it. An improvement needs to keep all those different use cases in mind. I know that they exist but not what the particular details are.

2 Likes

I am newly Racket minted (great IDE)... I used APL decades ago and now J prototyping. Both old and new great IDE's and don't have selectable dialects (sets of libraries) - but they could. Shortly focusing on Jesse Alama's "Server: Racket—Practical Web Development with the Racket HTTP Server" book then trying out Picolisp. Then pulling out some APL snippets - https://aplcart.info/ - and recode into Racket and Picolisp.

2 Likes