Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

There seems to be two major ways to set up a web server backend. You can use a LAMP stack, with the server-side code in something like PHP or Python (or Ruby or JavaScript, which don't start with a P.) These scripting languages tend to be dynamically typed, with all of the disadvantages in performance, correctness and maintainabilty that dynamically typed languages bring, but it's easy to update the server because all the page generation logic is stored in external scripts.

The other major architecture style in wide use is ASP.NET, where the page generation logic is written in compiled code. This tends to use statically typed languages, so you get code that's had the benefit of a compiler, but all of the page generation logic is compiled into the server, which means if you need to change something, you have to take the server down and replace it with a new build.

So that makes me wonder. Are there any server-side scripting languages that use static typing, for the best of both worlds?

share|improve this question
2  
Have you thought about using Go? –  p.s.w.g Apr 14 '13 at 16:55
7  
TypeScript? –  Oded Apr 14 '13 at 17:27
2  
"all of the disadvantages in performance, correctness and maintainabilty that dynamically typed languages bring". These assertions are debatable at best, and wrong at worst (the fastest JITs nowadays are for dynamically typed languages). –  Javier Apr 14 '13 at 17:33
1  
"page generation logic is compiled into the server, which means if you need to change something, you have to take the server down and replace it with a new build." There are several server environments that can handover to a new binary without service interruption. ie. uWSGI graceful reload –  Javier Apr 14 '13 at 17:35
1  
For the JVM there's a couple of frameworks that allows you to recompile and hot swap on the fly. –  back2dos Apr 14 '13 at 19:04
show 2 more comments

3 Answers

You should try Google Dart.

It has optional typing, which means that you can add type annotations that will be checked in 'checked' aka developer mode at runtime, but they are not required and the language provides many of the advantages of other dynamic languages like python. However, the editor will do type inference to try to help you find errors ahead of time. The dart VM is fast and can produce snapshots, which can accelerate startup time up to 10x. It also compiles down to javascript and it's fast.

The main downside here is that is a somewhat new technology, so there aren't as many libraries for it, and honestly, interoperability with javascript is not as simple as it should be. Also, the language is still in development, so there are breaking changes from time to time.

share|improve this answer
add comment

Your question is based on several incorrect assumptions.

Python, Ruby are both compiled to bytecode before execution. The process is automatic, but application changes require a full restart. Node.JS behaves the same way but compiles to machine code.

ASP.NET code can be precompiled and copied to the server or dynamically compiled on demand from source code on the server. IIS handles both forms of updates without zero down time (the first requests after the update will be slow.) Zero downtime updates are possible with Python and Ruby, but with so many deployment options, are not something to be taken for granted.

Based on that, I would think that you would be happy with any .NET language.

share|improve this answer
2  
A scripting language is when you can write some bits of it in a file and run it. There's no reason it shouldn't be statically typed. –  Florian Margaine Apr 14 '13 at 18:34
    
@FlorianMargaine So C is a scripting language? –  delnan Apr 14 '13 at 19:30
    
@delnan c++ too. –  mikerobi Apr 14 '13 at 19:35
    
@mikerobi Actually "mine" is C++ too (and AFAIK the successor of CINT), I just screwed up that bit. –  delnan Apr 14 '13 at 19:39
1  
@mikerobi If you explore picoc, you'll notice the whole point it was written in the first place is to be a scripting language. It's not just an interpreter for c, it's an interpreter small enough to be embedded in larger applications and devices and give their users the ability to write small scripts in c. Some languages are may be better at scripting than others, but a language isn't bad at scripting just because it hasn't been used for it (yet). At the end of the day, a language is just syntax and semantics, implementations may vary wildly. –  Yannis Rizos Apr 15 '13 at 3:14
show 3 more comments

Try the Yesod framework which is for the Haskell language. Haskell is strongly typed with a very rich type system.

I have not used it personally, but the folks I know who use it love it.

share|improve this answer
2  
Don't confuse strong and static typing. Haskell has strong static types, Python has strong dynamic types. –  mikerobi Apr 16 '13 at 14:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.