More range woes: composed ranges are unsafe to return from functions

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Oct 18 23:22:29 PDT 2012


On 10/19/12 8:17 AM, H. S. Teoh wrote:
> On Fri, Oct 19, 2012 at 04:24:53AM +0200, Marco Leise wrote:
>> Am Tue, 16 Oct 2012 17:28:47 -0700
>> schrieb "H. S. Teoh"<hsteoh at quickfur.ath.cx>:
>>
>>> On Tue, Oct 16, 2012 at 09:47:36PM +0200, jerro wrote:
>>>>> Hmm. There *is* a delegate being passed to map(). Would that
>>>>> cause problems? Theoretically it shouldn't, but as you said, if
>>>>> dmd isn't handling it correctly that could cause problems.
>>>>
>>>> I'm looking at the disassembly of cprod
>>>> (http://pastebin.com/ngTax6B8) and there doesn't seem to be a call
>>>> to _d_allocmemory in it. AFAIK it should be if the memory for the
>>>> variables that the delegate uses was allocated on the heap?
>>>
>>> Filed bug:
>>>
>>> 	http://d.puremagic.com/issues/show_bug.cgi?id=8832
>>>
>>> Whew, what a day! Two compiler bugs, no less, and a whole bunch of
>>> Phobos issues. I think I may need to take a break from D for a day
>>> or two. :-/
> [...]
>> And that's where all the good projects end... :D
> [...]
>
> Actually, I just went back to working on my personal D project for a
> bit. I was a bit disappointed that what I thought would be a quick
> side-job (implement cartesianProduct in std.algorithm) turned out to get
> stymied by compiler bugs and Phobos issues.

Admittedly cartesianProduct is a nontrivial juxtaposition of quite a few 
other artifacts. The question here is whether this is just endless churn 
or real progress. I'm optimistic, but am curious about others' opinion.

[snip]
> So yes, D still has a ways to go, and it does have its warts, but it's
> heaven compared to C++.

One question is how it compares against other languages that foster 
similar bulk processing, such as C# or Scala.


Andrei


More information about the Digitalmars-d mailing list