Re: Beta D 2.068.1-b2

2015-09-05 Thread Dylan Knutson via Digitalmars-d-announce

On Saturday, 5 September 2015 at 11:30:20 UTC, BBasile wrote:

On Monday, 31 August 2015 at 13:15:57 UTC, BBasile wrote:
waiting feedback:

https://github.com/dymk/temple/issues/31

this error message is so strange. Maybe the author is not very 
reachable now so you might also want to try to compile because 
you know better.


Bugzilla filed for reduced test case. It looks like a DMD 
regression (the reduced test case for TempleContext only compiles 
just fine in 2.068.0). I've included a reduced standalone 
temple_context.d and variant.d


https://issues.dlang.org/show_bug.cgi?id=15017


Re: crate.d a draft for a mvc library

2014-11-29 Thread Dylan Knutson via Digitalmars-d-announce

On Thursday, 27 November 2014 at 19:16:24 UTC, gedaiu wrote:

Hi,

In the last weeks I tried to make a draft for a mvc library. I 
tried to take advantage of templates, uda and ctfe to make the 
interaction with the database and the routing easier. There is 
still a lot of work to do for making it ready to work in 
production... but anyway.. what do you think?


https://github.com/gedaiu/crate.d

Thanks,
Bogdan


Hi,

I noticed you had your own templating library to parse the .dh 
files, so I thought I'd mention my project Temple which does 
something similar: https://github.com/dymk/temple
It's perhaps a bit more feature complete, and can handle stuff 
like capturing blocks of code, render to arbitrary output ranges, 
etc. That being said, your solution is very nice; it's amazing 
what you can do in so few lines of code in D :)


MongoModel in the model part of crate.d is interesting, and I'm 
glad to see there's a more structured way of interacting with 
MongoDB than just poking at untyped objects. I think D is still 
missing a really good ORM (Rikki's dvorm is a start), but there's 
nothing out there that conforms to the activerecord pattern as 
far as I can tell.


Separate compilation of Temple templates

2014-11-25 Thread Dylan Knutson via Digitalmars-d-announce
Also, because long compile times due to template compilation are 
a pain for both Vibe's Diet and Temple, I've put together a repo 
demonstrating how to do separate compilation with Temple 
templates:


https://github.com/dymk/temple-separate-compilation

The idea is to put views in separate Dub submodules, so if the 
views don't change, the submodule isn't recompiled with the rest 
of the application.


Temple v0.7.0: New API, Fewer Allocations

2014-11-22 Thread Dylan Knutson via Digitalmars-d-announce

Hey all,

I'd like to announce the release of Temple 0.7.0, a compile time
templating engine for D. It's been a while since the last major
release, and 0.7.0 brings a lot of changes and enhancements.

Temple is a library for embedding arbitrary D code in text
templates, similar to Vibe.d's Diet, or JS's Jade, but agnostic
about the format of the text that it should output (much more
similar to Ruby's ERB).

An example, dynamically rendering text with embedded D code:

---
auto hello = compile_temple!(Hello, %= var.name %);
auto ctx = new TempleContext;
ctx.name = Walter;
writeln(hello.toString(ctx)); // Writes Hello, Walter to stdout
hello.render(stdout, ctx);// also writes Hello, Walter to
stdout
---

Templates can be arbitrarily nested, and the library includes a
feature for 'yield'ing partial templates into a larger layout
template. The Filter feature can dynamically transform template
text as it's written to the output buffer, and can be used to
build concepts like Safe Strings and automatic HTML escaping
filters.

I encourage you to look at some of the examples in the (fairly
extensive) README.
Here's the GitHub repo: https://github.com/dymk/temple

For previous users of Temple, I'm sorry that the API has broken
backwards compatibility. If you'd like to keep the old API,
please keep tracking the 0.6.x versions. However, upgrading to
0.7.x should be a straightforward task of changing some 'alias'es
to 'auto', and 'Temple{etc}' to 'compile_temple_{etc}'. More
information on upgrading is available on the release page, here:
https://github.com/dymk/temple/releases/tag/v0.7.0

Thank you!
-- Dylan


Re: D2 port of Sociomantic CDGC available for early experiments

2014-10-16 Thread Dylan Knutson via Digitalmars-d-announce




Wouldn't it be more generally useful to have another function 
like main() called init() which if present (optional) is called 
before/during initialisation.  It would be passed the command 
line arguments.  Then a program can chose to implement it, and 
can use it to configure the GC in any manner it likes.


Seems like this could be generally useful in addition to 
solving this issue.


Isn't this what module constructors are for? As for passed in 
parameters, I'm sure there's a cross platform way to retrieve 
them without bring passed them directly, ala how Rust does it.


Re: Mono-D v2.4.9 - Parser fixes

2014-09-24 Thread Dylan Knutson via Digitalmars-d-announce

In the release notes:

Sep 23th 2014


Ah yes, who can forget September twentythirth? ;-)

Thanks for your work on Mono-D, it has made Xamarin studio a 
viable IDE for me.


Re: DlangUI

2014-05-20 Thread Dylan Knutson via Digitalmars-d-announce

Awesome! I can't wait to try it out. Some screenshots in the
README would be much appreciated, though


Re: Regal: An SQL relational algebra builder

2014-05-19 Thread Dylan Knutson via Digitalmars-d-announce

On Friday, 16 May 2014 at 13:42:30 UTC, Jacob Carlborg wrote:

On 16/05/14 09:58, Dylan Knutson wrote:

Ya know, it might be able to be made into a struct; I'll 
fiddle with it
tomorrow. The main reason it was made a class was so .join had 
to take a
Table type as its first parameter, and internally Table 
implements a
Joinable interface (which is needed for chaining .joins and 
propagating

the table name during printing).


Can you do compile time introspection, like ranges do? 
Basically check if it has a join method.




I've played around with making things structs a bit more, and 
have modified regal to have Table and Sql be structs (by having 
Sql and the generic Node class wrapped in a tagged union). Making 
Table a struct was just a matter of putting some common methods 
in a template mixin, and mixin'ing that where appropriate.


New version is at ~master on github and code.dlang.org


Re: Regal: An SQL relational algebra builder

2014-05-16 Thread Dylan Knutson via Digitalmars-d-announce

Does this need to be a class, can it be a struct instead?


Ya know, it might be able to be made into a struct; I'll fiddle 
with it tomorrow. The main reason it was made a class was so 
.join had to take a Table type as its first parameter, and 
internally Table implements a Joinable interface (which is needed 
for chaining .joins and propagating the table name during 
printing).


Why is 'new Sql(*)' needed? If you need to have a specific 
type, could it be a struct instead?


The Sql class is needed because it's a node in the AST (all nodes 
inherit from a basic Node class) that just prints out its content 
verbatim when to_sql is called. All the methods that take a Node 
would need to be modified/templated to also accept a specialized 
SQL struct type, which unfortunately isn't feasible. If it was 
done, it'd probably be implemented using std.variant's Algebraic 
type, but then CTFE is forfeited. If you know of another way to 
go about doing this, I'd be really interested in hearing it. It 
is unfortunate that the library has to make so many small 
allocations, for sure.


Another option is, you could try using CTFE as much as possible 
to get the allocations over with at compile time :)





The library can be found at: https://github.com/dymk/regal
And the dub package: http://code.dlang.org/packages/regal


This all looks pretty nice :). Does it work at compile time?


Thank you! I haven't tested it, but it's not using any features 
that would impede CTFE. So that's a solid probably.


Regal: An SQL relational algebra builder

2014-05-15 Thread Dylan Knutson via Digitalmars-d-announce

Hi all,

I'd like to announce the initial version of Regal, an SQL 
relational algebra builder for D. It's intended as a backbone for 
a relational database ORM, in line with how Arel works with 
Rails' ActiveRecord, but nearly any project that generates SQL 
dynamically can benefit from it. The goal of the library is to 
make programmatically generating queries simple (and more robust 
than simple string concatenation), and to be database agnostic 
(it's very easy to write database specific printers for a Regal 
AST).


There are extensive examples available in the Readme about how to 
use the library, from generating very simple queries (SELECT * 
FROM users) to multiple chained joins and nested constraints. 
Here's an example from the documentation: finding a user with ID 
1:


```
auto users = new Table(
  users, // table name
  id,// the rest are columns
  name,
  created_at,
  updated_at);

// SELECT * FROM users WHERE users.id = 1 LIMIT 1
users
  .where(users.id.eq(1))
  .limit(1)
  .project(new Sql(*))
  .to_sql
```

The library can be found at: https://github.com/dymk/regal
And the dub package: http://code.dlang.org/packages/regal

Please let me know if you find any bugs via the Github tracker!

Regards,
Dylan