www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D for dynamic web pages

reply Zodiachus <zodiachus gmail.com> writes:
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?
Nov 03 2006
next sibling parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
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
Nov 03 2006
parent Mike Parker <aldacron71 yahoo.com> writes:
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/
Nov 03 2006
prev sibling next sibling parent Chris Nicholson-Sauls <ibisbasenji gmail.com> writes:
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
Nov 03 2006
prev sibling next sibling parent John Demme <me teqdruid.com> writes:
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/
Nov 03 2006
prev sibling parent reply "Unknown W. Brackets" <unknown simplemachines.org> writes:
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?

Nov 03 2006
parent reply Zodiachus <zodiachus gmail.com> writes:
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?
Nov 07 2006
parent "Unknown W. Brackets" <unknown simplemachines.org> writes:
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?

Nov 07 2006