Dlang seems like java now,but why not let d more like C# Style?
Meta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Mar 14 18:19:29 PDT 2015
On Sunday, 15 March 2015 at 00:56:24 UTC, Ellery Newcomer wrote:
> On Saturday, 14 March 2015 at 23:57:33 UTC, weaselcat wrote:
>> On Saturday, 14 March 2015 at 23:46:28 UTC, Ellery Newcomer
>> wrote:
>>> And C# has LINQ, which when combined with the last point is
>>> fricken awesome.
>>
>> what does LINQ offer that UFCS-style functional programming
>> does not?
>
> LINQ basically is a UFCS-style api. AST reflection is what
> makes it nice.
>
> consider:
>
> X.Where(x => x.Members.Count() == x.Admins.Count())
>
> straightforward in both D and C# when X is an array or
> container type.
>
> When X is a table in a database, things get tricky for D.
>
> C# can interpret the lambda as an Expression<Func> (an AST
> type), so the implementation of X can reflect over the body of
> the lambda and use it to generate the appropriate SQL. ORMs
> such as entity framework and nhibernate do this now.
Somewhat off-topic, but you could theoretically embed SQL
directly in your D code using string mixins and have it
statically checked at compile time (this would be pretty advanced
usage, though).
mixin SQL!q{
INSERT INTO Person(name, age, occupation)
VALUES ('John', 25, 'Programmer')
};
More information about the Digitalmars-d-learn
mailing list