Ask coding questions

← Back to all posts
Is there a way to change the REPL's language, while it's running?

(edited: fixed typo)

It appears like one should be able to do so by changing the .replit file and adding the right language = "..." entry (at least this is how it works when importing a repl from GitHub). However, the same does not seem to work when the repl is running, i.e. after you edit your .replit and refresh the page, the loaded repl still uses the previously defined language.

Is this because the instance the repl is running on has already been provisioned (and I would have to wait for it to be terminated first), or simply it's not possible to change one repl language after it's been created?



the language paramater actually doesn't do anything.
The language that the repl is is set when you first import it.


@Coder100 are you sure about that? When I first imported this GitHub repository [0] as a new repl, it did not have language = "nix" inside .replit, and the repl got created with language equal to "Bash". Then I added language = "nix", re-imported it, and the repl turned out with language set to "Nix".

So I think language = ... inside .replit does indeed something...but maybe just at repl creation time.



no, it really doesn't.
It is optional, and remember: when you create the repl, you specified the language in a dropdown. @iamFIREcracker


@Coder100 I just told you I imported a repl from Github, so I did not explicitly selected a Language from the dropdown, simply because there was no dropdown to begin with.

I repeat:

  • Same repo
  • Without language = "nix", the repl got imported with language set to Bash
  • With language = "nix", the repl got imported with language set to Nix

Maybe I got lucky, but I find it hard to believe that setting language = inside .replit does not do anything at all -- simply because I got different results when I did specify it, and when I did not.


@iamFIREcracker well the thing is
it sort of doesn't do anything

in a way its really misleading because once you set it, you can't change it.


You can't change the language of a repl, but the .replit file can change which file runs. If you want a different replit language just copy+paste everything into a new repl


@MrVoo so just to confirm:

  • you can add language = "nix" to .replit, but that will be used only while importing repls from git/GitHub (I just tried this, so I am sure it works this way)
  • any subsequent change to that line will have no effect, and the only way to change language would be delete+create

@iamFIREcracker I have no idea how nix works :3 You can probably find a tutorial on replit's blog


@iamFIREcracker No, @MrVoo is incorrect. The repl language can't be changed, but that doesn't mean you can't run other languages. You just have to use run='bash command' in the .replit file


That's what I said though D: