FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The welcome mat for C programmers

 
Post new topic   Reply to topic     Forum Index -> General
View previous topic :: View next topic  

Should we make attempts to recruit C programmers into the D community?
No
0%
 0%  [ 0 ]
Yes, through showing our awesome libraries
6%
 6%  [ 1 ]
Yes, through showing how you can use D to leverage the power of existing libraries
93%
 93%  [ 15 ]
Total Votes : 16

Author Message
snoyberg



Joined: 17 Jan 2007
Posts: 10

PostPosted: Mon Apr 02, 2007 2:09 pm    Post subject: The welcome mat for C programmers Reply with quote

Hey all,

I'm sure this post is going to tick off some people, but please consider it. I think as a community we should be trying to appeal more to current C programmers in the OSS community who might want a more OO language without the overhead (like Java/C#) or the pain (C++).

However, here's a few hurdles to D's adoption by these people:

    The two choices for library. If I want a lot of people to use my program, then how do I choose between the two?

    The multitude of build programs. The D build tools are much easier to use than autotools, but autotools is a known entity in the OSS world, and end users know more more easily to type in "./configure && make && make install" than "bud" (or dsss, or compd, etc).

    The lack of a complete GUI. I know that there is a lot available, but there is nothing that is easily installable, and thus it is difficult to get end users to use it.


So what if we try and sell a new approach to help people migrate from C? It's entirely possible (ie, I wrote a proof-of-concept) to write a GUI app that's cross-platform, easily buildable, and depends only on a D compiler. The program is called Snoycards. I think that this kind of approach would be much easier to swallow for someone with extensive C experience.

Michael
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Tue Apr 03, 2007 8:54 am    Post subject: Re: The welcome mat for C programmers Reply with quote

snoyberg wrote:
I'm sure this post is going to tick off some people, but please consider it. I think as a community we should be trying to appeal more to current C programmers in the OSS community who might want a more OO language without the overhead (like Java/C#) or the pain (C++).
I think that's an interesting point. I've never really programmed in C, but I think that D could certainly appeal to those who do. I feel like Walter has intended D to welcome C people at least as much as C++ people.

snoyberg wrote:
However, here's a few hurdles to D's adoption by these people:

    The two choices for library. If I want a lot of people to use my program, then how do I choose between the two?

    The multitude of build programs. The D build tools are much easier to use than autotools, but autotools is a known entity in the OSS world, and end users know more more easily to type in "./configure && make && make install" than "bud" (or dsss, or compd, etc).

    The lack of a complete GUI. I know that there is a lot available, but there is nothing that is easily installable, and thus it is difficult to get end users to use it.


So what if we try and sell a new approach to help people migrate from C? It's entirely possible (ie, I wrote a proof-of-concept) to write a GUI app that's cross-platform, easily buildable, and depends only on a D compiler. The program is called Snoycards. I think that this kind of approach would be much easier to swallow for someone with extensive C experience.

Michael
As far as building tools for D go, I think that Bud has in many ways established itself as the standard. Rebuild is the new competitor -- it hasn't been around long, but it's gained popularity quickly. The old school "make" is a classic (or a dinosaur depending on a person's perspective). Everything else has its niche. But things are still in flux, and there's still room for new competitors. It looks like your program just uses make. Is that right? Or did you write a program to generate the makefile? That could be a good solution. (I think someone has already done some work in that direction, but I can't remember who?)

Anyway, I haven't compiled your proof-of-concept, but it sounds like a feasible way to demonstrate how one can use GTK+, Glade, XML, and SQLite with D. Do you intend just to instruct C users how to do this with BCD themselves, or do you plan to make these bindings (and other useful bindings) available in a package (sort of like how the Derelict project works).
Back to top
View user's profile Send private message AIM Address
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Thu Apr 05, 2007 1:30 am    Post subject: Re: The welcome mat for C programmers Reply with quote

snoyberg wrote:
The lack of a complete GUI. I know that there is a lot available, but there is nothing that is easily installable, and thus it is difficult to get end users to use it.

GTK+ is a very nice library, but it does look and feel a bit "alien" on the Windows and Mac OS X platforms. Sorta like Swing or Tk, only more so ?

So it would be better to have a graphics library that used GTK+ on the Unix platforms, but the native platforms on Win32 or MacOS (not GTK+).
Back to top
View user's profile Send private message
snoyberg



Joined: 17 Jan 2007
Posts: 10

PostPosted: Thu Apr 05, 2007 11:02 am    Post subject: Reply with quote

(I'm responding to multiple posts here)

Quote:
As far as building tools for D go, I think that Bud has in many ways established itself as the standard. Rebuild is the new competitor -- it hasn't been around long, but it's gained popularity quickly. The old school "make" is a classic (or a dinosaur depending on a person's perspective). Everything else has its niche. But things are still in flux, and there's still room for new competitors. It looks like your program just uses make. Is that right? Or did you write a program to generate the makefile? That could be a good solution. (I think someone has already done some work in that direction, but I can't remember who?)


I'm not complaining about the build tools, I think they're great (and much better than make). However, C programmers probably want 1) something they're used to and 2) something that everyone else has. Get them sold on the language, and eventually they'll get tired of make and want to use something else. And once packages start using bud/rebuild, then distributions might start actually including them. That's my hope, at least.

Quote:
Anyway, I haven't compiled your proof-of-concept, but it sounds like a feasible way to demonstrate how one can use GTK+, Glade, XML, and SQLite with D. Do you intend just to instruct C users how to do this with BCD themselves, or do you plan to make these bindings (and other useful bindings) available in a package (sort of like how the Derelict project works).


As far as I'm concerned, gtkD is the project with that intent. My goal is to show C programmers how easy it is to leverage their existing library knowledge. I have no intention of trying to draw attention away from the well-established projects already in place.

Quote:
GTK+ is a very nice library, but it does look and feel a bit "alien" on the Windows and Mac OS X platforms. Sorta like Swing or Tk, only more so ?

So it would be better to have a graphics library that used GTK+ on the Unix platforms, but the native platforms on Win32 or MacOS (not GTK+).


I think you should check out tioport http://www.dsource.org/projects/tioport. It automatically converts Java to D, and is being used to convert the SWT codebase to D, thus bringing a native GUI to each system. However, I doubt C programmers are very interested in learning a Java API.
Back to top
View user's profile Send private message
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Thu Apr 05, 2007 12:42 pm    Post subject: Reply with quote

snoyberg wrote:

As far as I'm concerned, gtkD is the project with that intent. My goal is to show C programmers how easy it is to leverage their existing library knowledge. I have no intention of trying to draw attention away from the well-established projects already in place.


I'm not familiar with the differences between gtkD and DUI, but I know that GTK+ (with glib) is a simple platform to work with - when I tried it from C.

Quote:

Quote:
GTK+ is a very nice library, but it does look and feel a bit "alien" on the Windows and Mac OS X platforms. Sorta like Swing or Tk, only more so ?

So it would be better to have a graphics library that used GTK+ on the Unix platforms, but the native platforms on Win32 or MacOS (not GTK+).


I think you should check out tioport http://www.dsource.org/projects/tioport. It automatically converts Java to D, and is being used to convert the SWT codebase to D, thus bringing a native GUI to each system. However, I doubt C programmers are very interested in learning a Java API.


Sure, DWT/tioport will be nice when it's ready. Meanwhile you might also want to look into wxD which just wraps wxWidgets. It's ported over from C++ and C#, though. (= not D)

MinWin isn't too bad either, in all its modesty. (it also wraps GTK+)
Back to top
View user's profile Send private message
WebDrake



Joined: 02 Oct 2007
Posts: 9

PostPosted: Tue Oct 09, 2007 8:53 am    Post subject: Reply with quote

Speaking as a (mostly) C programmer (though amateur rather than professional) the main issue I can see with D is the difficulty of linking with existing C/C++ libraries. The picture given on the Digital Mars website ...
http://www.digitalmars.com/d/htomodule.html
http://www.digitalmars.com/d/htod.html
... is not inspiring: it seems like a very irritating process to have to manually build wrappers for code you want to use.

If I could make one single request of D development it would be for easy linking to C/C++ libraries (vice-versa would also be nice).

It's especially annoying because D in its own right seems like a really, really nice language. Much more so than C++.
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Tue Oct 09, 2007 10:02 am    Post subject: Reply with quote

By the way, D 2.x isn't stable yet, but a new feature was recently added that should make it easier to link to C++ code: Interfacing to C++.

I'm not saying it's perfect (you're probably limited in which C++ compilers you can use), but it sounds a lot better than the old way where you probably had to create a C wrapper for the C++ project.
Back to top
View user's profile Send private message AIM Address
WebDrake



Joined: 02 Oct 2007
Posts: 9

PostPosted: Thu Oct 11, 2007 7:37 am    Post subject: Reply with quote

jcc7 wrote:
By the way, D 2.x isn't stable yet, but a new feature was recently added that should make it easier to link to C++ code: Interfacing to C++.

I'm not saying it's perfect (you're probably limited in which C++ compilers you can use), but it sounds a lot better than the old way where you probably had to create a C wrapper for the C++ project.

This sounds good. I have a lot of faith in D to do interesting things so I hope one of these days it will be as simple as an #include line in C++ is.

The other important thing (from my point of view) will be serious engagement with GDC (I think it's very important the language have a completely free compiler) and getting proper autotools support. I know that D comes with its own quite exciting looking build tools but the GNU build system is widely used and useful especially where languages are being mixed. I've had some brief discussions with autotools people about this and they suggest it shouldn't be too difficult, so I may try to make a contribution here (time allowing).
Back to top
View user's profile Send private message
Destructionator



Joined: 17 Sep 2007
Posts: 9
Location: New York State

PostPosted: Fri Oct 12, 2007 1:48 pm    Post subject: Reply with quote

WebDrake wrote:
... is not inspiring: it seems like a very irritating process to have to manually build wrappers for code you want to use.

If I could make one single request of D development it would be for easy linking to C/C++ libraries (vice-versa would also be nice).

Technically, linking with C libraries is trivial - it is telling the compiler what they are that you have to do (not quite wrapping them either).

All you really need to do is put enough there so the name is right and the compiler doesn't complain about the arguments. What I often do is copy-paste the declaration for the function or struct I want from the .h file into an extern(C) block in the D file where it is used. Remove all const qualifiers and change all pointers to void* - the bits are all the same anyway.



It is a little big of a hassle, sure, but doing it with functions as you need them using a few shortcuts rather than trying to do the whole header up front makes it not feel so bad.
Back to top
View user's profile Send private message
pqnelson



Joined: 03 Jun 2007
Posts: 13
Location: Davis

PostPosted: Wed Oct 31, 2007 5:41 pm    Post subject: Reply with quote

I think the biggest headache for C programmers who would start using D would be several fold:

1) The type casting is a pain in the ass if you are doing low level stuff like file systems programming (I know this from experience, I'm writing a virtual file system in D).
2) Also, dynamic arrays are nice, but they require the garbage collector which is unorthodox in systems programming. Using pointers to deal with this is a wee bit odd in D, for me at least.
3) The lack of macros kindof forces the programmer to use templates in some instances. This can be seen as a good thing or a bad thing, depending on how your approach to programming is. Being a file systems programmer, this is a bad thing because it unnecessarily bloats up the code.

I know this one isn't really relevant to how C programmers feel about D, but I just had to throw this in because it's tangential to point (1):

4) In C, it's acceptable to write code like
Code:
#include <stdlib.h>
#include <stdio.h>

int main(void)
{
   char a = 5;
   int b = a;
   printf("a=%d\nb=%d\n",a,b);
   return 0;
}

Surprisingly this sort of casting is done a lot in low level C. In D you have to "b = cast(int)a;" which is a little hectic after a while.

5) Further, not everything is an object in D, so one has to resort to using Boxes or Variants. Again, this may be good or bad depending on how you stand on things, but it just doesn't seem object oriented to me...

Just my little rant I guess, I still like D Smile
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> General All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group