Thread overview
D for dynamic web pages
Nov 03, 2006
Zodiachus
Nov 03, 2006
Lars Ivar Igesund
Nov 03, 2006
Mike Parker
Nov 03, 2006
John Demme
Nov 07, 2006
Zodiachus
November 03, 2006
Do you guys think that D would be a suitable language for server-side dynamic content handling? If so, what would one need to do to be able to use D instead of PHP/ASP/whatnot?
November 03, 2006
Zodiachus wrote:

> Do you guys think that D would be a suitable language for server-side dynamic content handling? If so, what would one need to do to be able to use D instead of PHP/ASP/whatnot?

Well, it requires more tooling infrastructure than what is available today, to really make it simple and usable.

See the discussions on the DSP forum over www.dsource.org. The DDL project started because of those.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource & #D: larsivi
November 03, 2006
Lars Ivar Igesund wrote:
> Zodiachus wrote:
> 
>> Do you guys think that D would be a suitable language for server-side
>> dynamic content handling? If so, what would one need to do to be able to
>> use D instead of PHP/ASP/whatnot?
> 
> Well, it requires more tooling infrastructure than what is available today,
> to really make it simple and usable.


Anywhere you can use C, you can use D.

Getting Started with CGI Programming in C: http://www.cs.tut.fi/~jkorpela/forms/cgic.html

Boutell's ANSI C CGI Library (cgic):
http://www.boutell.com/cgic/
November 03, 2006
Zodiachus wrote:
> Do you guys think that D would be a suitable language for server-side dynamic
> content handling? If so, what would one need to do to be able to use D instead
> of PHP/ASP/whatnot?

You've already been pointed to DSP and suggested CGI, so my response has already been made.  But I would like to add that I have a CGI branch in the Cashew library that needs fleshing out, so if you'd have any suggestions for that, I would be most appreciative. (It has almost nothing at the moment, just environment variables and URL encoding/decoding.)

-- Chris Nicholson-Sauls
November 03, 2006
If you're OK with something more like Java Servlets, check out Mango at dsource.org.  It's got an http server (a really fast one) and a servlets engine that's pretty easy to use.  It's certainly a templating system like PHP, but it runs pretty freaking fast and is pretty simple to use.

~John Demme

Zodiachus wrote:

> Do you guys think that D would be a suitable language for server-side dynamic content handling? If so, what would one need to do to be able to use D instead of PHP/ASP/whatnot?

-- 
~John Demme
me@teqdruid.com
http://www.teqdruid.com/
November 04, 2006
Just doing a CGI won't be very efficient, but if you use FastCGI you'll get pretty good performance.

I'd suggest looking into FastCGI.  It's actually very easy to implement - you just listen on a socket and handle each connection separately. You don't have to use threading, but if you did it would probably be more efficient.

That said, the best way (imho) is an Apache module, ISAPI extension, etc.  This is more work, of course.  This is how PHP/etc. are implemented typically.

-[Unknown]


> Do you guys think that D would be a suitable language for server-side dynamic
> content handling? If so, what would one need to do to be able to use D instead
> of PHP/ASP/whatnot?
November 07, 2006
Thanks for the input everyone. So there are a few ways to go about this it seems. Now I just need to figure out which way would be the best to go.

On that note, I have a few questions:
Are there any good guides/tutorials/examples on how to call D code from C and vice
versa?
How do you search the D forums here without actually including results from the
entire site?
November 08, 2006
Calling C code in D:

/* C code */
void foo()
{
...
}

/* D code */
extern (C)
void foo();

...

foo();

Calling D code in C:

/* C code */
void foo();

...

foo();

/* D code */
extern (C)
void foo()
{
...
}

But if you pass dynamically allocated pointers, arrays, objects, etc. around you have to make sure to keep a reference for the GC.

For searching... something like this?

http://www.google.com/search?q=site%3Adigitalmars.com+inurl%3Apnews%2Fread

-[Unknown]


> Thanks for the input everyone. So there are a few ways to go about this it seems.
> Now I just need to figure out which way would be the best to go.
> 
> On that note, I have a few questions:
> Are there any good guides/tutorials/examples on how to call D code from C and vice
> versa?
> How do you search the D forums here without actually including results from the
> entire site?