March 18, 2013
On Sunday, 3 February 2008 at 12:25:17 UTC, Michiel Helvensteijn wrote:
> bearophile wrote:
>
>> LINQ (and its future parallel extensions), with its additional syntax, may
>> be a good thing to add to D:
>>
> http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html
>> 
>> You can use the same syntax to simplify parallel code, DB access code,
>> etc.
>
> Can't D already do this?
>
> It has lazy evaluation of function literals, so the container class just has
> to implement the count method.
>
> Even C++ can do this, though it looks more messy.
>
> Anyway, I disagree with the author about (at least) two things.
>
> * I am one of those people that use the pre-increment operator in for-loops.
> I know it doesn't improve performance for integers, but it does for
> iterators. So I just use it everywhere for consistency.
>
> * While I agree that when a foreach-loop is possible, you should use it, it
> can never completely replace the for-loop, because it is simply less
> powerful. Any number of sorting/searching algorithms still need for-loops.

Really?!

for loops can be easily replaced by functional alternatives map/reduce.

With tail call optimizations you can even replace them by recursive calls without performance loss.

--
Paulo

March 18, 2013
On 2013-03-18 01:03, Kapps wrote:

> This thread was posted 5 years ago. :P It just got bumped up today.
>
>
> As for the implementation of lambdas to generate SQL queries and the
> like, there was a pull request for a __traits(codeof) that could have
> been used to do such a thing. Unfortunately, there were issues with it
> in some fundamental way, and it was scrapped. A __traits(astof) would be
> quite interesting for this.

Sounds like AST macro to me.

-- 
/Jacob Carlborg
March 18, 2013
> Can anyone else think of a better alternative?

Compile-time Pegged  (once the CTFE mem issues are solved)

https://github.com/PhilippeSigaud/Pegged
March 18, 2013
On Monday, 18 March 2013 at 10:47:35 UTC, bls wrote:
>
>> Can anyone else think of a better alternative?
>
> Compile-time Pegged  (once the CTFE mem issues are solved)
>
> https://github.com/PhilippeSigaud/Pegged

I have to add that in Nemerle Linq is implemented using PEG Macros. Same is valid for DBC etc..
1 2
Next ›   Last »