July 26, 2012
I'm quite new to D, and I've just been reading the guides. I just wanted to say I'm very impressed with some of the features I'm reading about. Slices, closures, the scope keyword(!!!), class variable initialisers, anonymous array literals, array concatenation, synchronisation... even decent exception support is a breath of fresh air compared to C++.

I'm primarily a .NET coder these days, but sometimes you really need more performance. Writing an OpenGL game in VB.NET is just pointless - it doesn't execute fast enough to be of any use, even using display lists. So, next time I need something a little more C-like, I'll be loading up D straight away.

I have a couple of questions though. Why does the VisualD plugin crash Visual Studio if I double-click a .sln file in Windows Explorer? I mean, every single time? I'm using VS2010 on Windows 7 64-bit; and the problem only happens with D projects, and only when loading an .sln file by association. If I load VS and use the menu to open the solution, it works fine.

Why does D have GOTO? I haven't used GOTO in over a decade, because it's truly evil.

How good is the Entice Designer? I'd like to write some GUI apps in D, but I need to know that the designer won't fall over halfway through; and I'll be damned if I'm writing my GUI code by hand. Even MFC programmers have a "dialog designer".

One thing I really think D ought to have is iterators, like VB.NET and C# have. Trust me, they're really damn useful. Any chance of them being implemented? The implementation of .NET iterators is well-known and fairly straightforward; all we need is compiler support.
July 27, 2012
On Thursday, 26 July 2012 at 23:59:13 UTC, Stuart wrote:
> I'm quite new to D, and I've just been reading the guides. I just wanted to say I'm very impressed with some of the features I'm reading about. Slices, closures, the scope keyword(!!!), class variable initialisers, anonymous array literals, array concatenation, synchronisation... even decent exception support is a breath of fresh air compared to C++.
>
> I'm primarily a .NET coder these days, but sometimes you really need more performance. Writing an OpenGL game in VB.NET is just pointless - it doesn't execute fast enough to be of any use, even using display lists. So, next time I need something a little more C-like, I'll be loading up D straight away.
>
> I have a couple of questions though. Why does the VisualD plugin crash Visual Studio if I double-click a .sln file in Windows Explorer? I mean, every single time? I'm using VS2010 on Windows 7 64-bit; and the problem only happens with D projects, and only when loading an .sln file by association. If I load VS and use the menu to open the solution, it works fine.
>
> Why does D have GOTO? I haven't used GOTO in over a decade, because it's truly evil.
>
> How good is the Entice Designer? I'd like to write some GUI apps in D, but I need to know that the designer won't fall over halfway through; and I'll be damned if I'm writing my GUI code by hand. Even MFC programmers have a "dialog designer".
>
> One thing I really think D ought to have is iterators, like VB.NET and C# have. Trust me, they're really damn useful. Any chance of them being implemented? The implementation of .NET iterators is well-known and fairly straightforward; all we need is compiler support.

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).

Regards,
Brad Anderson
July 27, 2012
On Fri, Jul 27, 2012 at 01:59:12AM +0200, Stuart wrote:
> I'm quite new to D, and I've just been reading the guides. I just wanted to say I'm very impressed with some of the features I'm reading about. Slices, closures, the scope keyword(!!!), class variable initialisers, anonymous array literals, array concatenation, synchronisation... even decent exception support is a breath of fresh air compared to C++.

I think certain usages of the scope keyword is being phased out?
(Somebody else can clarify this.)


[...]
> Why does D have GOTO? I haven't used GOTO in over a decade, because it's truly evil.

You don't have to use it. In my experience with C++ and D, I've never needed to use goto. (I do use it sometimes in C mainly because error handling is so horrible in C otherwise.)


[...]
> One thing I really think D ought to have is iterators, like VB.NET and C# have.

D has something far superior: ranges.

	http://www.informit.com/articles/printerfriendly.aspx?p=1407357&rll=1

Even better, they are completely implemented in the library. No unnecessary language bloat just to support them.


T

-- 
Ph.D. = Permanent head Damage
July 27, 2012
Welcome! :)

On 07/26/2012 04:59 PM, Stuart wrote:

> Why does D have GOTO? I haven't used GOTO in over a decade, because it's
> truly evil.

GOTO is evil; 'goto' is not! ;) goto makes switch-case statements safer in D:

  http://dlang.org/statement.html#GotoStatement

> iterators

Here is a paper that compares different approaches:

  http://www.informit.com/articles/printerfriendly.aspx?p=1407357

Ali

July 27, 2012
On Thursday, July 26, 2012 17:18:38 H. S. Teoh wrote:
> On Fri, Jul 27, 2012 at 01:59:12AM +0200, Stuart wrote:
> > I'm quite new to D, and I've just been reading the guides. I just wanted to say I'm very impressed with some of the features I'm reading about. Slices, closures, the scope keyword(!!!), class variable initialisers, anonymous array literals, array concatenation, synchronisation... even decent exception support is a breath of fresh air compared to C++.
> 
> I think certain usages of the scope keyword is being phased out?
> (Somebody else can clarify this.)

scope on local variables is going to be deprecated, because it's unsafe. scope on function parameters and scope statements are here to stay.

> [...]
> 
> > Why does D have GOTO? I haven't used GOTO in over a decade, because it's truly evil.
> 
> You don't have to use it. In my experience with C++ and D, I've never needed to use goto. (I do use it sometimes in C mainly because error handling is so horrible in C otherwise.)

If you're using goto much in code, then you're doing somethnig wrong, but it would be a problem for a systems language _not_ to have a goto statement. On rare occasions (especially when writing low level code), they end up being very useful.

Now, D has made goto even less necessary than it is in most languages (e.g. it has labeled break and labeled continue which go to a label in a loop), but the language should still have it.

- Jonathan M Davis
July 27, 2012
On Friday, 27 July 2012 at 00:25:49 UTC, 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.

There's also scope(exit), scope(success), and scope(failure),
which aren't going anywhere.
July 27, 2012
On Friday, July 27, 2012 02:46:20 Adam D. Ruppe wrote:
> On Friday, 27 July 2012 at 00:25:49 UTC, 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.
> 
> There's also scope(exit), scope(success), and scope(failure),
> which aren't going anywhere.

Yeah. Those are scope statements.

It's just scope on local variable declarations which is going away.

- Jonathan M Davis
July 27, 2012
Stuart:

> Why does D have GOTO? I haven't used GOTO in over a decade, because it's truly evil.

Gotos are not so evil. Just use them when they are useful and they can't be replaced by structured programming. In D I create finite state machines at compile-time that use gotos, they are quick.

Bye,
bearophile
July 27, 2012
On Friday, 27 July 2012 at 00:57:15 UTC, bearophile wrote:
> Stuart:
>> Why does D have GOTO? I haven't used GOTO in over a decade, because it's truly evil.
>
> Gotos are not so evil. Just use them when they are useful and they can't be replaced by structured programming. In D I create finite state machines at compile-time that use gotos, they are quick.

 As mentioned, why would GOTO be evil?

 http://en.wikipedia.org/wiki/BASIC

 I'm remembering back when i used an Atari (For others, Commodore64 and Apple IIe), where the BASIC programming language supplied (via rom or built in) didn't have function calling and instead everything used GOTO statementes (Or GOSUB).

 Obviously spaghetti came about easily, but when the GOTO is dropped to only being a logical jump when no other options are available. Consider half a dozen GOTO's with labels nearby vs thousands.
July 27, 2012
Stuart wrote:
> Why does D have GOTO? I haven't used GOTO in over a decade, because it's truly evil.

There are some who use it, and I imagine it's in there for their benefit. Thought I agree, I've rarely ever used goto.


> I have a couple of questions though. Why does the VisualD plugin crash Visual Studio if I double-click a .sln file in Windows Explorer? I mean, every single time? I'm using VS2010 on Windows 7 64-bit; and the problem only happens with D projects, and only when loading an .sln file by association. If I load VS and use the menu to open the solution, it works fine.

I know many are attached at the hip to Visual Studios, but I recommend MonoDevelop + Mono-D plugin for D programming. It's very nice, with the exception of a few bug, it offers is *similar* experience to Visual Studios C#/VB. Plus it's cross platform, if/when you take your projects to other platforms it helps a lot to use a consistent tool.


> One thing I really think D ought to have is iterators, like VB.NET and C# have. Trust me, they're really damn useful. Any chance of them being implemented? The implementation of .NET iterators is well-known and fairly straightforward; all we need is compiler support.

Ranges are a very good alternative. However there's also D-Collections (http://www.dsource.org/projects/dcollections/) which supports a "Cursor" type, similar to iterators (to my knowledge).

The biggest issue with D's collections IMO, are std.container's lack of useful structures. For instance there's no standard Doubly-Linked-List type. However, I understand that Andrei is currently working on a new allocation system, which should pave the way to a new standard collection lib.

« First   ‹ Prev
1 2 3 4 5 6 7 8 9 10 11
Top | Discussion index | About this forum | D home