On 07/26/2012 06:58 PM, Stuart wrote:
> On Friday, 27 July 2012 at 00:23:54 UTC, Ali Çehreli wrote:
> Well, kinda. "Goto case" and such are one thing, but allowing the
> arbitrary use of goto for jumping around from label to label.... I just
> don't understand why the language even supports this.
Unlike C++, the language disallows unsafe jumping forward (or is it dmd
that disallows it?). Hmmm... Maybe I am wrong... (?) I swear, the
following code used to generate a compilation error:
if (aCondition) {
goto label; // Jumps over s's constructor call
}
auto s = S(7);
label:
s.foo();
The error used to say:
"Error: cannot goto forward into different try block level."
The code is allowed by dmd 2.059.
The code is allowed for classes as well but of course there is a
segmentation faault due to foo() on the null object. Strange...
> Anyone using 'goto
> label' in their code is doing it wrong. Period.
I agree.
Ali

On 7/26/2012 4:59 PM, Stuart wrote:
> Why does D have GOTO? I haven't used GOTO in over a decade, because it's truly
> evil.
The road to hell is paved with good intentions, so we felt it necessary to add a
touch of eeeevil.
> One thing I really think D ought to have is iterators,
We call them "ranges" in D. :-) I think you'll like them.

On 2012-07-27 02:10, Brad Anderson wrote:
> D uses ranges instead of iterators. You can read more about them here:
> http://ddili.org/ders/d.en/ranges.html
>
> I find ranges to be a vast improvement over iterators personally (I use
> iterators extensively in C++ for my job and lament not having ranges
> regularly).
Note that iterators in .NET and C++ are a bit different. .NET has
language support with the "yield" keyword.
--
/Jacob Carlborg

On Friday, July 27, 2012 08:36:17 Jacob Carlborg wrote:
> On 2012-07-27 02:25, Jonathan M Davis wrote:
> > scope on local variables is going to be deprecated, because it's unsafe.
> > scope on function parameters and scope statements are here to stay.
>
> "scope" on class declarations as well.
I didn't even know that you could do that, and I have no idea what that would
do.
- Jonathan M Davis

On 2012-07-27 08:41, Jonathan M Davis wrote:
> On Friday, July 27, 2012 08:36:17 Jacob Carlborg wrote:
>> On 2012-07-27 02:25, Jonathan M Davis wrote:
>>> scope on local variables is going to be deprecated, because it's unsafe.
>>> scope on function parameters and scope statements are here to stay.
>>
>> "scope" on class declarations as well.
>
> I didn't even know that you could do that, and I have no idea what that would
> do.
If I recall correctly it forces you do use "scope" when declaring a
variable of the class.
http://dlang.org/class.html#auto--
/Jacob Carlborg