How D may replace PHP & ASPX on the Web!!!

Adam Ruppe destructionator at gmail.com
Tue Jul 19 10:24:51 PDT 2011


Matthew Ong
> The KEY idea that I am trying to suggest is the modeling of the D Web
> Framework that could beat google go

Go's offering for web apps is very, very poor (at least it was last
I checked when they did that "web apps in go" advertisement). It
seemed content with offering only the bare minimum.

D is already much better.

>  The framework itself should be a single pid within the OS.

Why?

Note btw: D already has this. My cgi.d can be used with an embedded
http server, meaning all data is handled by a single process.

But I recommend against it because that's less robust. If the one
process dies, everyone suffers.

It also doesn't scale as well as a multiple process approach, but
this is surely my implementation more than anything else.


There are things I kinda like about single process, but the
robustness is a huge hit against it.

>  Browser site time format might
> allow hacker to mess the time info of attacks.

No, you still use one time format inside the app. Timezone
translation is only done for user input and output.

> I actually in favor the Microsoft asmx + aspx approaches here, but
> the aspx and asmx must be within the same SINGLE PID memory space.

It looks like that has a lot in common with web.d.

In web.d, you implement a service like this:

===
class MySite : ApiProvider {
   int add(int a, int b) { return a+b; }
   string sayHello(string name) { return "Hello, " ~ name ~ "!"; }
}
===


If you're in the same process, you can call the functions directly:

===
auto api = new MySite();
assert(api.add(1, 2) == 3);
===

It's just a regular class, so you call methods normally if you're
local. If you are on a remote server, a very similar interface
lets you call the functions remotely.

Javascript example:

MySite.add(1, 2).get(alert); // calls alert(3);

You can also do other languages, nested calls, custom formats, etc.

Anyway, this is super fast if local - it's just a method call - and
reasonably fast and accessible if remote, while giving nice looking
code.

It gets really cool when you start using enums, alias, and structs
though.

> True, but many many web application is currently not yet mobile
> ready because they are stuck in the CGI model(Aspx/JSP/Strut)
> rather than the full MVC model like asmx + aspx.

Meh, those fancy sites tend to work worse in my experience.


> I am on +0800GMT what time zone you are on?

I'm at GMT - 0400


More information about the Digitalmars-d mailing list