February 11, 2013
On 2013-02-11 21:37, Jacob Carlborg wrote:
> On 2013-02-11 20:08, FG wrote:
>> I'm struggling with the temptation to move a Python website to vibe.d.
>> What keeps me from doing that are Django templates. Not even because
>> vibe's templates have to be recompiled each time some small markup
>> change is introduced -- I got used to that with LaTeX ;) -- but because
>> of Jade. It's way too far off course from HTML for my tastes. I see no
>> reason for inventing a completely new format when all you need is
>> templating.
>
> I like Haml, it's similar to Jade but without the pipes for the plain text.
>
> What about plain HTML, like Ruby (Erb) or PHP uses.


The problem I have with those is that they are designed for HTML.
What if I wanted to make an email template instead?

February 11, 2013
On Mon, 11 Feb 2013 20:08:44 +0100
FG <home@fgda.pl> wrote:

> Great project -- a flagship example of D's real world application!
> 
> On 2013-02-11 19:11, Ali Çehreli wrote:
> > same code as Python, translated to D. Of course, the solution that use vibe.d does not have Python's infamous GIL; instead, it comes with parallelism and concurrency out of the box. And you are aware of typos in your code even before running your program. ;)
> 
> Running worker processes can make the GIL problem a little less of a PITA, but having the typos pointed out before running the app... is just priceless. :)
> 
> I'm struggling with the temptation to move a Python website to vibe.d. What keeps me from doing that are Django templates. Not even because vibe's templates have to be recompiled each time some small markup change is introduced -- I got used to that with LaTeX ;) -- but because of Jade. It's way too far off course from HTML for my tastes. I see no reason for inventing a completely new format when all you need is templating.
> 
> So let me use this opportunity to ask you: is somebody working on other template systems for vibe.d already or shall I get involved myself? I'm thinking about something similar to this, syntax-wise: http://jinja.pocoo.org/

I admit I'm not a fan of Jade either. Indent-syntaxes just aren't my thing. And fixing the larger semantic issues I have with HTML/CSS isn't part of Jade's charter, AFAICT. (That said, I don't have any problem with it being in Vibe.d.)

Personally, I just use Adam's HTML DOM for D: https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff

I've built up a couple utility libs that use the DOM to help automate some stuff (defining a page, caching rendered pages, repeating elements on a page, building/validating forms). It's mostly independent of Vibe.d, but I do use it with Vibe.d.

I've been planning to release those utility libs when they're a little bit more ready (they're still a little too closely integrated into a private project of mine, and they still need some more work).

February 11, 2013
On Monday, 11 February 2013 at 21:06:41 UTC, FG wrote:
> On 2013-02-11 21:37, Jacob Carlborg wrote:
>> On 2013-02-11 20:08, FG wrote:
>>> I'm struggling with the temptation to move a Python website to vibe.d.
>>> What keeps me from doing that are Django templates. Not even because
>>> vibe's templates have to be recompiled each time some small markup
>>> change is introduced -- I got used to that with LaTeX ;) -- but because
>>> of Jade. It's way too far off course from HTML for my tastes. I see no
>>> reason for inventing a completely new format when all you need is
>>> templating.
>>
>> I like Haml, it's similar to Jade but without the pipes for the plain text.
>>
>> What about plain HTML, like Ruby (Erb) or PHP uses.
>
>
> The problem I have with those is that they are designed for HTML.
> What if I wanted to make an email template instead?

If you need a D templating engine that can be used for anything, not just HTML, you could try http://mustache.github.com/.
February 11, 2013
On Mon, 11 Feb 2013 12:53:55 +0100
Sönke Ludwig <sludwig@outerproduct.org> wrote:

> Changes:
> 
>  - Refactored the MongoDB client to better match the actual database
>    structure + range interface for query results (by Dicebot)
> 
>  - A number of important fixes in the HttpClient and ConnectionPool
> 
>  - Correct memory alignment is now enforced in the custom memory
> allocators (Caused exceptions on 32-bit Linux)
> 
>  - Added task management methods (interrupt(), join() and running)
> 
>  - Lots of smaller fixes and enhancements
> 
> Full change log: http://vibed.org/blog/posts/vibe-release-0.7.12 Download: http://vibed.org/download?file=vibed-0.7.12.zip GitHub: https://github.com/rejectedsoftware/vibe.d

The full changelog is missing this:

HttpFileServerSettings.maxAge is changed from (was it int/ulong/..? Forget what it was) to Duration. Pull #178

February 11, 2013
On 2013-02-11 22:07, FG wrote:

> The problem I have with those is that they are designed for HTML.
> What if I wanted to make an email template instead?

Erb is like a Ruby preprocessor that can be used for any format. It's used for many things in Ruby on Rails:

index.html.erb - Erb preprocessor, result is HTML

<% if foo %>
  <li>asd</li>
<% end %>

bar.js.coffee.erb - Erb then CoffeeScript preprocessor, result is JavaScript

<% if foo %>
  bar = -> console.log("asd")
<% end %>

foo.text.erb - Erb preprocessor, result is plain text

<% if foo %>
  asd
<% end %>

database.yml.erb - Erb preprocessor, result is YAML

development:
  username: <%= username %>
  password: <%= password %>

-- 
/Jacob Carlborg
February 11, 2013
Am 11.02.2013 12:53, schrieb Sönke Ludwig:
> Changes:
> 
>  - Refactored the MongoDB client to better match the actual database
>    structure + range interface for query results (by Dicebot)
> 
>  - A number of important fixes in the HttpClient and ConnectionPool
> 
>  - Correct memory alignment is now enforced in the custom memory allocators
>    (Caused exceptions on 32-bit Linux)
> 
>  - Added task management methods (interrupt(), join() and running)
> 
>  - Lots of smaller fixes and enhancements
> 
> Full change log: http://vibed.org/blog/posts/vibe-release-0.7.12 Download: http://vibed.org/download?file=vibed-0.7.12.zip GitHub: https://github.com/rejectedsoftware/vibe.d
> 

Cool, but one thing hinders me from moving from Python to Vibe, is a Postgres DB driver (any plans on integrating Postgres?)

and (non vibe related) something so amazing and fucking awesome like
SqlAlchemy!
February 11, 2013
I have considered writing and proposing one, but it is a very low priority to me now, sorry. Should be not that difficult considering driver for MySQL can be used as an example ( http://registry.vibed.org/packages/mysql-native ), just time-consuming.
February 12, 2013
Am 11.02.2013 20:08, schrieb FG:
> 
> So let me use this opportunity to ask you: is somebody working on other template systems for vibe.d already or shall I get involved myself? I'm thinking about something similar to this, syntax-wise: http://jinja.pocoo.org/

I personally also wanted to start a purely text based template system for a while*, but never got around to it, yet. My idea was to make something that is similar to the existing template syntax, so it feels more consistent (i.e. use #{expr} or !{expr} for inserting strings). I also wanted to more directly use D statements instead of special casing all of them, like the Twig-likes do - which is a lot of work and probably has higher memory requirements during compilation (which is already often at it's limit right now).

Of course, for people coming from Twig/Django it would be a big familiarity advantage to provide the same syntax, and existing templates could be reused. So that would be great to have.

However, as soon as I really need it and nothing else exists yet, I will probably implement a very basic version of the former that can be extended later. Twig, from the first looks, just seems like much more involved than I can afford for this ATM.


* For HTML I very much prefer to have all the syntax overhead of HTML taken off. It's faster to type and more readable (more readable also because it's possible to leave blank lines to structure the code without having them appear in the output). But of course this is a topic of personal taste/preference.
February 12, 2013
Am 11.02.2013 22:29, schrieb Nick Sabalausky:
> On Mon, 11 Feb 2013 12:53:55 +0100
> Sönke Ludwig <sludwig@outerproduct.org> wrote:
> 
>> Changes:
>>
>>  - Refactored the MongoDB client to better match the actual database
>>    structure + range interface for query results (by Dicebot)
>>
>>  - A number of important fixes in the HttpClient and ConnectionPool
>>
>>  - Correct memory alignment is now enforced in the custom memory
>> allocators (Caused exceptions on 32-bit Linux)
>>
>>  - Added task management methods (interrupt(), join() and running)
>>
>>  - Lots of smaller fixes and enhancements
>>
>> Full change log: http://vibed.org/blog/posts/vibe-release-0.7.12 Download: http://vibed.org/download?file=vibed-0.7.12.zip GitHub: https://github.com/rejectedsoftware/vibe.d
> 
> The full changelog is missing this:
> 
> HttpFileServerSettings.maxAge is changed from (was it int/ulong/..? Forget what it was) to Duration. Pull #178
> 

Thanks, it's in now. It's easy to get lost in the commit log/issue list.

It would be nice to have an automated solution, but that won't work, as trivial things and fixes for unreleased stuff just adds noise and needs to be manually filtered out somehow...
February 12, 2013
On Monday, 11 February 2013 at 21:41:33 UTC, Jacob Carlborg wrote:
> On 2013-02-11 22:07, FG wrote:
>
>> The problem I have with those is that they are designed for HTML.
>> What if I wanted to make an email template instead?
>
> Erb is like a Ruby preprocessor that can be used for any format. It's used for many things in Ruby on Rails:
>
> index.html.erb - Erb preprocessor, result is HTML
>
> <% if foo %>
>   <li>asd</li>
> <% end %>
>
> bar.js.coffee.erb - Erb then CoffeeScript preprocessor, result is JavaScript
>
> <% if foo %>
>   bar = -> console.log("asd")
> <% end %>
>
> foo.text.erb - Erb preprocessor, result is plain text
>
> <% if foo %>
>   asd
> <% end %>
>
> database.yml.erb - Erb preprocessor, result is YAML
>
> development:
>   username: <%= username %>
>   password: <%= password %>

This really makes sense for D. It can be easily combined with D's mixin capabilities to make it so you don't even need to implement stuff like various loops:

<%  [d code] %>   ->   [d code]
<%= [d expr] %>   ->   buffer.write([d expr]);
    [text]        ->   buffer.write("[text]");

NMS