Apache "mod_d" needs C to instantiate D interpreter?
Eric Poggel
dnewsgroup2 at yage3d.net
Tue Nov 9 15:57:44 PST 2010
On 11/9/2010 12:17 AM, Nick Sabalausky wrote:
> "Andrei Alexandrescu"<SeeWebsiteForEmail at erdani.org> wrote in message
> news:ibaepi$vfh$1 at digitalmars.com...
>>
>> People at Facebook told me that the adoption of D inside the company might
>> be helped if they could simply write<?d ... ?> to insert D code into a
>> page. I'm not sure how difficult such a plugin would be to implement.
>
> I'm very suprised by that. That's become considered very bad style by most
> of the [professional] web dev world quite awhile ago, and for very good
> reason. Rails-, django- and even ASP.NET-style "pass variables into an HTML
> template" approaches have proven to be...well...frankly, much less shitty.
>
>
I've always felt the opposite way. It's been a while since I've worked
with Asp.net controls, but I remember something like this:
<ul id="List"></ul>
.....
// Later, in C#
for (int i=0; i<10; i++)
List.innerHtml += "<li>" + sanitize(someArray[i]) + "</li>"
While php would do something like:
<ul id="List">
<?php foreach($someArray as $item):?>
<li><?=sanitize($item)?></li>
<?php endforeach?>
</ul>
Granted, C# is a much nicer language than php, and when in php, I always
separate model and controller logic from the html view, but the
"immediate mode" of php embedding helps me avoid the awkwardness of
building html through string concatenations in another file. I get to
see the html structure exactly as it is.
This is where people usually jump in and suggest a templating system,
but I think it's silly to invent a second language when the first is
more than up to the task. I always find myself thinking: I know how to
do this in php or java, but how do I do this in the templating language?
I welcome counter-arguments. Maybe I can be enlightened?
More information about the Digitalmars-d
mailing list