The new, new phobos sneak preview
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Apr 6 15:29:50 PDT 2009
dsimcha wrote:
> == Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
>> Hi everybody,
>> I just committed all of Phobos into svn on dsource.org. That is not an
>> official release and has known and unknown bugs, limitations, and
>> rhinodemons. I expect some ripples before we stabilize, but when we will
>> we'll stabilize at a higher potential.
>
> Is this pretty much everything, or is there even more to come? I want to start
> porting some code to the new Phobos, or at least thinking about how to change the
> code to best make use of the new Phobos, but I don't want to do it until at least
> the more radical, earthquake-like changes have been unveiled.
>
> P.S. It looks fantastic!
Thanks! This is all I have, and I think from here on there will be more
additions instead of big changes. There is one major change not effected
yet, which affects both the compiler and phobos: the renaming of head,
toe, next, and retreat to (respectively) front, back, popFront, and
popBack. Also in foreach we will make the following change:
foreach (e; range) body
from:
for (auto copy = range; !copy.empty; copy.popFront)
{
auto e = copy.front;
body
}
with:
for (auto copy = range[]; !copy.empty; copy.popFront)
{
auto e = copy.front;
body
}
Notice the extra [] when getting the copy of the range. The reason is
that people want to do:
foreach (e; container) {}
when the container is actually not a range. Operator [] for a range will
simply return the range itself. For a container, it will return that
container's preferred range.
Andrei
More information about the Digitalmars-d
mailing list