Arc Forumnew | comments | leaders | submitlogin
1 point by idoh 4939 days ago | link | parent

I thought about that but I've decided to leave arc behind, but take my favorite things about it with me. In particular, I really like the http server because it is great to do web dev on a repl-based server.


1 point by aw 4939 days ago | link

I'm not sure whether you mean by "leaving Arc behind but taking some things with you" you want to be able to write your own programs in Racket but use Arc libraries that are useful to you, or to have no Arc code running in your system at all?

If you mean you'd like to use Arc's http server from Racket, the answer is yes, you can write your programs in Racket and use Arc libraries if you want to. It's currently rather awkward, but we can help you with that if you want.

Or if you mean you don't want to be running any Arc code at all, I suppose you could translate the Arc library you want into Racket. I can't quite tell why you'd want to do that, because it would be a lot of work and you would end up with a library that did the same thing anyway as the Arc library you already can use anyway.

You also asked if there's an "automatic" way to translate Arc into Racket. The answer to that as rntz explained is yes, that's what the Arc compiler does. It takes Arc code and translates it into Racket. But that's really the same as option one.

Perhaps you're asking if there's an automatic way to translate Arc into readable Racket. No, the Arc compiler produces a giant blob of Racket code. The Arc compiler produces working Racket code, but not code that you can look at and see what it's doing (not without a lot of work, at any rate), or to be able to modify yourself at all easily. So the answer to the question "is there an automatic way to translate Arc code into Racket code readable by humans" the answer to that one is no.

Or, if using Arc libraries from your Racket program is more trouble than it's worth right now (and I imagine it could be), perhaps you'd like to implement a REPL with Racket's web server. Of course the Arc forum probably isn't the best place to ask about that, the Racket email lists would probably be more help, but I imagine it's probably possible since Racket does have eval.

-----

1 point by rocketnia 4939 days ago | link

"Or, if using Arc libraries from your Racket program is more trouble than it's worth right now (and I imagine it could be), perhaps you'd like to implement a REPL with Racket's web server. Of course the Arc forum probably isn't the best place to ask about that, the Racket email lists would probably be more help, but I imagine it's probably possible since Racket does have eval."

It's actually kind of an example in (the most advanced part of) the Racket getting started pages:

> Given the "many" example, it’s a small step to a web server that accepts arbitrary Racket code to execute on the server. In that case, there are many additional security issues besides limiting processor time and memory consumption. The racket/sandbox library provides support to managing all those other issues. (http://docs.racket-lang.org/more/index.html)

The racket/sandbox module reference has another example:

> For example, here is a quick implementation of a networked REPL... (http://docs.racket-lang.org/reference/Sandboxed_Evaluation.h...)

These examples complement each other. The first doesn't actually 'eval any client input, and the second uses a TCP socket directly rather than bothering with session handling or HTTP, but each of them picks up the other's slack. I'm a bit surprised there aren't many Racket Web REPLs for Racket the way there are for Arc.

-----