Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does anyone use Pascal for web development (cgi, dynamically generated web sites)?

I would love to use a fast, low-memory, natively-compiled, strongly typed language with a clear, readable syntax. Pascal meets all these requirements.

Golang is the other language I'm considering. It has many web-related libraries, excellent documentation and a lot of momentum. Free Pascal, unfortunately suffers from fragmented documentation (the wiki is often out-of-date and hard to navigate). Despite that, I still prefer Pascal syntax over Go (yes, really).

So, if you are using Pascal for web development, what has been your experience? Would you recommend it?



Our web site is driven by natively-compiled Object Pascal code (written using Delphi) that dynamically generates every single page:

http://www.elevatesoft.com

(it needs a face-lift, for sure)

Our product Elevate Web Builder allows you to write client web applications using Object Pascal and a RAD IDE:

http://www.elevatesoft.com/products?category=ewb&type=web

(examples are at bottom of the page)

The IDE/compiler/web server used in Elevate Web Builder were written using Delphi. We've also written two small database engines, as well as two ODBC drivers and a .NET data provider, using Object Pascal and Delphi. Object Pascal is a very versatile and useful language that allows you to write applications that do just about anything from front-end UIs to back-end server code. Being able to debug server-side code in the IDE is a life-saver and allows one to get to the root of any coding issues immediately.

FreePascal is also equally nice, albeit a little rougher around the edges in certain places. But, every year it gets better and more polished and has come a very long way since its humble origins.


Well, yes and no.

I used Pascal to write some web apps, i.e. computer graphics explanations [0], visual philosophy [1], and simple games [2].

It's a nice ability to have - being able to share complex programming as you share written text.

However, i wrote my own compiler that among other things output C, which is then Emscripten-translated to asm.js you see.

This is the complete opposite of an easy, low friction path you'd want for web development.

[0] http://orbides.org/apps/superslow.html [1] http://orbides.org/apps/motion.html [2] http://orbides.org/apps/the_bits.html


I'm considering building a high performance pascal wrapper around libuv, which should let me get the same pipeline performance that you can currently get out of asp.net core's "kestrel" web server. In a word, fast. Right now if people are using Indy as their HTTP component they will first of all have some strong limitations on what they can do with certificates and https, and secondly they will not have a very fast stack.


Maybe consider add libuv support for mORMot for the Linux part?



Agreed, I couldn't recommend mORMot more! Several more notes: - The docs for mORMot is very much lengthy and is not written by a native English speaker, you might feel overwhelmed getting started by reading it, but actually it's very simple to start, with the supplied 33 samples: https://github.com/synopse/mORMot/tree/master/SQLite3/Sample...

- with Lazarus/FreePascal, mORMot supports almost all Linux distros, check this forum post: http://synopse.info/forum/viewtopic.php?id=3319

- Check the commit logs of its github repository, see how active the development is.

- The FPC/Lazarus foundation (http://foundation.freepascal.org/) was launched several days ago, check the Projects menu - you can expect a lot of modern language features would be added.

- The newpascal.org site was launched recently to get you started easily for Linux web development with mORMot/Lazarus


I do. I don't use CGI, though. As I find the embedded web server is more reliable. However, changing between CGI, FastCGI amd embedded server is a matter of changing a single uses clause entry.

It's applicable for both the preshipped fpWeb and Brook, which is my choice of web framework due to its simpler and shorter hand coding.




The feature you really want for web-development is closures. I can't imagine writing event-handling code without them. As far as I know, Pascal does not have closures.

Unfortunately, with closures you need good memory handling. And this means either a complicated type-system such as Rust's, or a garbage collected environment. The way C++ does closures is too dangerous for event-driven code, imho.


I never need a closure. You need a shift in thinking, closures are much heavier than ordinary procedures, at least in Golang (yes, this is a real world experience).

Delphi has closures, FPC is on development, but in the end I won't use it much. I need performance and maintainability, closures are against those two.


> As far as I know, Pascal does not have closures.

They're called Anonymous Methods in Object Pascal:

http://docwiki.embarcadero.com/RADStudio/Berlin/en/Anonymous...

Free Pascal doesn't support them yet.


Why do you want closures for the web code? What do they add? What is hard to do without them?


To handle event call-backs. Generally, inside an event-handler, you want access to variables in a higher scope.


Two things:

1. You don't need closures at a language level to do event callbacks. Just the ability to refer to functions by reference and call those references. Closures certainly make it syntactically nicer, but you can work without them.

2. You don't need event callbacks in a webserver to make it performant. The memory/CPU overheads needed to make closures work are essentially identical to what's needed to make blocking threaded code work, as long as the threading is done in userspace and you have support for expanding stacks. Even if you don't have support for those niceties, modern kernels and hardware are perfectly capable of handling thousands of OS-level threads.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: