- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
scala compiler api?
Mon, 2009-02-23, 02:30
Hi,
I am looking for a way to use Scala in a "PHP" like fashion. I want to be able to drop in a scala script in a directory and instantly have that script available to process HTTP requests.
Thinking about this, I believe what is needed is a servlet that can be deployed on any servlet container such as Apache Tomcat. The servlet would accept requests and look in a script directory for scala scripts to process the request. If the request maps to a new script or the script has been modified since last request, it would compile the file before handing over the request.
Has anyone played with this idea before? If not, where can I find information about how to embed the scala compiler, so I can compile the scripts?
It would be cool if there was a way to have the scripts start in xml mode, instead of requiring an object or class definition. This way the script file would end being a pure xhtml file with scala code embedded in {} sections. But I do not think that is possible. I should be able to make it work with a few lines of boilerplate code at the start and end of the script file.
I would appreachiate any input.
The inspiration for this idea is to match PHPs extremely quick prototyping cycle. It simply takes too long to start up new project with maven and other heavy tools. We are competing against 20 lines of php code to do a quick job.
Thanks,
Baldur
I am looking for a way to use Scala in a "PHP" like fashion. I want to be able to drop in a scala script in a directory and instantly have that script available to process HTTP requests.
Thinking about this, I believe what is needed is a servlet that can be deployed on any servlet container such as Apache Tomcat. The servlet would accept requests and look in a script directory for scala scripts to process the request. If the request maps to a new script or the script has been modified since last request, it would compile the file before handing over the request.
Has anyone played with this idea before? If not, where can I find information about how to embed the scala compiler, so I can compile the scripts?
It would be cool if there was a way to have the scripts start in xml mode, instead of requiring an object or class definition. This way the script file would end being a pure xhtml file with scala code embedded in {} sections. But I do not think that is possible. I should be able to make it work with a few lines of boilerplate code at the start and end of the script file.
I would appreachiate any input.
The inspiration for this idea is to match PHPs extremely quick prototyping cycle. It simply takes too long to start up new project with maven and other heavy tools. We are competing against 20 lines of php code to do a quick job.
Thanks,
Baldur
Mon, 2009-02-23, 03:47
#2
Re: scala compiler api?
In Lift-land we use Jetty and JavaRebel for quick prototyping. There are some limitations to what JavaRebel can reload, but most of the time it works remarkably well. JavaRebel generously provides a free license for use with Scala.
--j
On Sun, Feb 22, 2009 at 5:29 PM, Baldur Norddahl <baldur.norddahl@gmail.com> wrote:
--j
On Sun, Feb 22, 2009 at 5:29 PM, Baldur Norddahl <baldur.norddahl@gmail.com> wrote:
Hi,
I am looking for a way to use Scala in a "PHP" like fashion. I want to be able to drop in a scala script in a directory and instantly have that script available to process HTTP requests.
Thinking about this, I believe what is needed is a servlet that can be deployed on any servlet container such as Apache Tomcat. The servlet would accept requests and look in a script directory for scala scripts to process the request. If the request maps to a new script or the script has been modified since last request, it would compile the file before handing over the request.
Has anyone played with this idea before? If not, where can I find information about how to embed the scala compiler, so I can compile the scripts?
It would be cool if there was a way to have the scripts start in xml mode, instead of requiring an object or class definition. This way the script file would end being a pure xhtml file with scala code embedded in {} sections. But I do not think that is possible. I should be able to make it work with a few lines of boilerplate code at the start and end of the script file.
I would appreachiate any input.
The inspiration for this idea is to match PHPs extremely quick prototyping cycle. It simply takes too long to start up new project with maven and other heavy tools. We are competing against 20 lines of php code to do a quick job.
Thanks,
Baldur
Mon, 2009-02-23, 10:27
#3
Re: scala compiler api?
>
> Hi,I am looking for a way to use Scala in a "PHP" like fashion. I want to be
able to drop in a scala script in a directory and instantly have that script
available to process HTTP requests.
You might also want to have a look at Apache Sling
(http://incubator.apache.org/sling/site/index.html) which supports various
scripting languages. Just recently I added scripting support for Scala. Be
warned though, Scala support is currently still kind of experimental and there
is no official documentation yet.
Michael
2009/2/22 Baldur Norddahl <baldur.norddahl@gmail.com>
--
Thanks,
-Vlad