April 30, 2012
On 30-04-2012 21:43, Jacob Carlborg wrote:
> On 2012-04-30 17:27, Alex Rønne Petersen wrote:
>> On 30-04-2012 09:58, Jacob Carlborg wrote:
>
>>> I would rather have @property on instance variables be a syntax sugar
>>> for implementing property functions. Basically virtual instance
>>> variables.
>>>
>>
>> Then there better be a way to mark them final too. ;)
>>
>
> Then what's the point of having a method? Just use a public instance
> variable.
>

Encapsulation. I want contracts in my properties.

-- 
- Alex
April 30, 2012
On 2012-04-30 18:44, Iain Buclaw wrote:

> GCC backend has some 50+ passes it processes the generated AST through
> passed from GDC. Not to mention it only outputs assembly code.  So
> there is some overhead for calling AS to compile to object code
> (something that DMD just compiles straight to), and double overhead
> for calling LD to link the resultant binary/library.

DMD calls GCC which calls LD. Unless your using the -lib flag.

-- 
/Jacob Carlborg
April 30, 2012
On 30-04-2012 21:50, Walter Bright wrote:
> On 4/30/2012 10:04 AM, Jonathan M Davis wrote:
>> I never claimed that I _was_ Walter. I was pointing out that there's very
>> little consensus in this thread (almost all of the comments are in
>> conflict
>> with other comments) so that even if it was our intention to go and
>> remove
>> things from the language based on this thread, there is very little, if
>> anything, that has a clear consensus on being removed. The closest would
>> probably be the comma operator, and there wasn't even a complete
>> consensus on
>> _that_.
>
> There is less agreement than I thought there would be.
>
> This thread also generated far more interest than I anticipated.
>
>> And while I obviously can't say for certain what Walter intended, it
>> was my
>> impression that the point of this thread was more out of curiosity and
>> for
>> "lessons learned" from designing D than to actually make any changes
>> to the
>> language right now (especially when you consider how much Walter hates
>> breaking backwards compatibility). But obviously, he'd have to clarify
>> for us
>> to know for sure.
>
> The first thing to emphasize is that NONE of this will happen for D2.
> The emphasis on D2 is fixing implementation and toolchain issues.
> Breaking existing code is off the table unless we are pretty much forced
> to in order to fix some other more important issue.
>
> So we're talking several years out.
>
> The evolution of C++ is interesting. So far, the C++ committee has shown
> incredible resistance to removing, or even deprecating, some features
> that pretty much everyone knows were a mistake, all in the interests of
> maintaining backwards compatibility. Some of C++'s success can be
> attributed to that, but also some of its endemic failures.
>
> Where's the line to draw between breaking existing code and modernizing
> / removing cruft / removing support for features that promote bad code? Of
> course, there can't be any fixed rule for that. Hearing peoples'
> opinions on it on a case by case basis helps a lot.
>
> We've had some success in deprecating mistaken features - the bit data
> type, and typedefs.
>
> I'm surprised nobody has mentioned opApply. That was a good idea at the
> time, but Ranges are a superior solution. I'd like to see new code not
> use opApply. It's a dead end, though it'll still be supported for a long
> time.
>

I think what we need is an article on ranges on dlang.org (I can't find one). They seem like a rather foreign concept when you come from other languages, like array slices, and need a proper introduction.

-- 
- Alex
April 30, 2012
On 30-04-2012 21:42, Jacob Carlborg wrote:
> On 2012-04-30 17:14, Alex Rønne Petersen wrote:
>> On 30-04-2012 09:08, Jacob Carlborg wrote:
>>> On 2012-04-29 22:26, Alex Rønne Petersen wrote:
>>>
>>>> IMHO r"" is better than `` for the simple reason that typing `` is
>>>> extremely annoying on non-US keyboards.
>>>
>>> `` is better because you don't have to escape ".
>>>
>>
>> That only applies when you actually have " in the string. I think both
>> have their uses.
>>
>
> When is r"" a better use than ``? We already have the regular "".
>

You don't have escape sequences inside r"", so they can be useful if you have backslashes in your string.

-- 
- Alex
April 30, 2012
On 04/30/2012 09:50 PM, Walter Bright wrote:
>
> I'm surprised nobody has mentioned opApply. That was a good idea at the
> time, but Ranges are a superior solution. I'd like to see new code not
> use opApply. It's a dead end, though it'll still be supported for a long
> time.
>

foreach has been mentioned. I don't think ranges are unequivocally a superior solution. opApply is more powerful for fancy iteration tasks, such as parallel foreach.
April 30, 2012
On Monday, 30 April 2012 at 19:58:49 UTC, Alex Rønne Petersen wrote:
> On 30-04-2012 21:50, Walter Bright wrote:
>
> I think what we need is an article on ranges on dlang.org (I can't find one). They seem like a rather foreign concept when you come from other languages, like array slices, and need a proper introduction.

There is one talk by Andrei
http://blip.tv/boostcon/boostcon-2009-keynote-2452140
and there is the chapter on Ali's book:
http://ddili.org/ders/d.en/ranges.html

April 30, 2012
On 30-04-2012 22:25, SomeDude wrote:
> On Monday, 30 April 2012 at 19:58:49 UTC, Alex Rønne Petersen wrote:
>> On 30-04-2012 21:50, Walter Bright wrote:
>>
>> I think what we need is an article on ranges on dlang.org (I can't
>> find one). They seem like a rather foreign concept when you come from
>> other languages, like array slices, and need a proper introduction.
>
> There is one talk by Andrei
> http://blip.tv/boostcon/boostcon-2009-keynote-2452140
> and there is the chapter on Ali's book:
> http://ddili.org/ders/d.en/ranges.html
>

Right, but we can't expect people who want to learn the language and its conventions to have to go to some external source for information. It has to be on dlang.org.

-- 
- Alex
April 30, 2012
On Monday, 30 April 2012 at 20:04:41 UTC, Timon Gehr wrote:
> On 04/30/2012 09:50 PM, Walter Bright wrote:
>>
>> I'm surprised nobody has mentioned opApply. That was a good idea at the
>> time, but Ranges are a superior solution. I'd like to see new code not
>> use opApply. It's a dead end, though it'll still be supported for a long
>> time.
>>
>
> foreach has been mentioned. I don't think ranges are unequivocally a superior solution. opApply is more powerful for fancy iteration tasks, such as parallel foreach.

Yes, I feel they are complementary. Ranges are cool for Python-style or functional-style programming, foreach and opApply reflects more traditional iteration.
I'm pretty sure that usage over time will show that they both have their use.
April 30, 2012
On Mon, 30 Apr 2012 15:50:00 -0400, Walter Bright <newshound2@digitalmars.com> wrote:

> I'm surprised nobody has mentioned opApply. That was a good idea at the time, but Ranges are a superior solution. I'd like to see new code not use opApply. It's a dead end, though it'll still be supported for a long time.

I think we've already covered this -- opApply does things that ranges could never do.  I think they can both live in harmony.  It's not even close to a dead end.  I look at opApply as foreach on a range with a stack-allocated context specifically for iteration.  Then of course, you can do stack-based traversal, which is not really possible for ranges.

A trivial example:

foreach(dchar d; "longstring") {}

treating "longstring" as a range, you cannot possibly get the performance opApply has (although, you have to be able to inline both the opApply call and the delegate calls, currently not supported for the above code), as it has to decode each dchar *twice*, once for getting d, and once for popping it off the front.

-Steve
April 30, 2012
On Monday, 30 April 2012 at 20:28:56 UTC, Alex Rønne Petersen wrote:
> On 30-04-2012 22:25, SomeDude wrote:
>> On Monday, 30 April 2012 at 19:58:49 UTC, Alex Rønne Petersen wrote:
>>> On 30-04-2012 21:50, Walter Bright wrote:
>>>
>>> I think what we need is an article on ranges on dlang.org (I can't
>>> find one). They seem like a rather foreign concept when you come from
>>> other languages, like array slices, and need a proper introduction.
>>
>> There is one talk by Andrei
>> http://blip.tv/boostcon/boostcon-2009-keynote-2452140
>> and there is the chapter on Ali's book:
>> http://ddili.org/ders/d.en/ranges.html
>>
>
> Right, but we can't expect people who want to learn the language and its conventions to have to go to some external source for information. It has to be on dlang.org.

I've put these links in the Wiki. They may not be visible enough, though. It still needs a lot of cleanup (although I've done a little bit of it).
Baically, the first one is in the tutorials. The second is in "Why switch ?"