www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Examples using Tango

reply Daren Scot Wilson <darenw darenscotwilson.com> writes:
I've been interested for a long time in learning D and using it for image 
processing and physics number crunching.  Now I've got a few days in a row 
to study.   Unfortunately I'm getting stuck even with "Hello World" due to 
most examples of D I find seem to be using Phobos instead of Tango.

Indeed, I'm not clear as to which is the best to use.  For me, "best" is 
defined primarily as "it works on my machine" but secondarily I care about 
speed and ease of use.

I'm using LDC (the llvm-based compiler) because it's 64-bit and maybe can 
handle D2.   The D1/D2 doesn't matter a lot, though the statement "D version 
2 which is recommended for new projects" on the home page sways me to use 
D2.   But 64 bit is vital, since I want to work on huge arrays.   The only 
limitation of LDC is apparently it works only with Tango.


If I could rub a genie's lamp and have three wishes granted, they are:

1) Is it possible to get the source and compile Phobos for use with LVM?

2) Existing code examples should always indicate whether they use Tango or 
Phobos.  Ideally, every example would be presented twice, once for each. 
This might be redundant or pointless for old-timers and D experts, but for 
newbies like me it would help avoid wasting time.

3)  I'd like to see a translation page with two columns, Phobos and Tango, 
showing how to do the most common things we all need to do - printf() or 
whatever, basic binary file i/o, etc. There could be a third column for C or 
C++ to help us C++ programmers make the transition.
Dec 29 2010
next sibling parent reply Jesse Phillips <jessekphillips+D gmail.com> writes:
Daren Scot Wilson Wrote:

 I've been interested for a long time in learning D and using it for image 
 processing and physics number crunching.  Now I've got a few days in a row 
 to study.   Unfortunately I'm getting stuck even with "Hello World" due to 
 most examples of D I find seem to be using Phobos instead of Tango.

http://www.dsource.org/projects/tango/wiki/Examples
 Indeed, I'm not clear as to which is the best to use.  For me, "best" is 
 defined primarily as "it works on my machine" but secondarily I care about 
 speed and ease of use.

32bit does run on a 64bit system. Work is being done for 64bit support in DMD. D2's Standard Library is still in flux. Several modules are deprecated and not properly marked. http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel#Roadmap
 I'm using LDC (the llvm-based compiler) because it's 64-bit and maybe can 
 handle D2.   The D1/D2 doesn't matter a lot, though the statement "D version 
 2 which is recommended for new projects" on the home page sways me to use 
 D2.   But 64 bit is vital, since I want to work on huge arrays.   The only 
 limitation of LDC is apparently it works only with Tango.

http://www.prowiki.org/wiki4d/wiki.cgi?D__Tutorial/StartingWithD/Compiler LDC is D1 Tango only. GDC has received updates to the latest versions of D1 and 2. There has been work on getting Phobos 2 to support 64bit, I don't know the issues with it or its status.
 If I could rub a genie's lamp and have three wishes granted, they are:
 
 1) Is it possible to get the source and compile Phobos for use with LVM?

You can find LDC source on Dsource.org though it won't be as simple as compiling it to get it working with Phobos.
 2) Existing code examples should always indicate whether they use Tango or 
 Phobos.  Ideally, every example would be presented twice, once for each. 
 This might be redundant or pointless for old-timers and D experts, but for 
 newbies like me it would help avoid wasting time.

Most examples are posted to a Wiki page, please mark them as you find issues. Generally un-marked indicates D1 Phobos; marked as Tango means D1; marked as D2 means Phobos. Things are not well marked, but anyone can help. http://www.prowiki.org/wiki4d/wiki.cgi?D__Tutorial/StartingWithD
 3)  I'd like to see a translation page with two columns, Phobos and Tango, 
 showing how to do the most common things we all need to do - printf() or 
 whatever, basic binary file i/o, etc. There could be a third column for C or 
 C++ to help us C++ programmers make the transition.

http://www.prowiki.org/wiki4d/wiki.cgi?ComingFrom I have provided links that are close to the information you are looking for, or to guide you on finding the needed information.
Dec 29 2010
next sibling parent bioinfornatics <bioinfornatics fedoraproject.org> writes:
hi quick answer:
1/ for d1 prefer tango

2/ ldc could be use with phobos

3/ see tango home page on dsource they are several example

4/ tango d2 is not ready you can help source: git clone 
git://supraverse.net/tango.git (compile with d2 compiler and fix error if you
want contribute)

5/ ldc source is not on dsource but bitbucket you will found ldc for
* d1 https://bitbucket.org/lindquist/ldc
* d2 https://bitbucket.org/prokhin_alexey/ldc2
Dec 29 2010
prev sibling next sibling parent reply Daren Scot Wilson <darenw darenscotwilson.com> writes:
On 12/29/10 17:05, Jesse Phillips wrote:

 D2's Standard Library is still in flux. Several modules are deprecated and not
properly marked.

fetish for arrowhead wounds in their back.
Dec 29 2010
next sibling parent Jesse Phillips <jessekphillips+D gmail.com> writes:
Daren Scot Wilson Wrote:

 On 12/29/10 17:05, Jesse Phillips wrote:
 
 D2's Standard Library is still in flux. Several modules are deprecated and not
properly marked.

fetish for arrowhead wounds in their back.

Well it shouldn't be naively used. But I and others have had little issue using the languages for small projects, and some medium sized ones, without the rug disappearing for some time. But their is not handy, documentation really is limited though.
Dec 29 2010
prev sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
Daren Scot Wilson:

 Overall, it sounds like no one should  be using D2 yet unless they have a 
 fetish for arrowhead wounds in their back.

I suggest to use D2 and help the improvement of Phobos :-) Bye, bearophile
Dec 29 2010
parent reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
On 12/30/2010 03:46 AM, spir wrote:
 On Thu, 30 Dec 2010 01:42:27 -0500
 bearophile<bearophileHUGS lycos.com>  wrote:

 Overall, it sounds like no one should  be using D2 yet unless they have a
 fetish for arrowhead wounds in their back.


Well, I don't have this impression in practice. Sure, on D lists, we discuss only the issues. But I use D2 everyday for a load of mini-apps or tools, explorations, and a moderately big but complicated project.

I do. I don't use DMD every day, but when I do I invariably have to issue bug reports.
Dec 30 2010
parent bioinfornatics <bioinfornatics fedoraproject.org> writes:
here i have written some example in d programming D1/tango:
http://blog.fedora-fr.org/bioinfornatics/
Dec 31 2010
prev sibling parent spir <denis.spir gmail.com> writes:
On Thu, 30 Dec 2010 01:42:27 -0500
bearophile <bearophileHUGS lycos.com> wrote:

 Overall, it sounds like no one should  be using D2 yet unless they have=


 fetish for arrowhead wounds in their back. =20


Well, I don't have this impression in practice. Sure, on D lists, we discus= s only the issues. But I use D2 everyday for a load of mini-apps or tools, = explorations, and a moderately big but complicated project.
 I suggest to use D2 and help the improvement of Phobos :-)

Yop! Denis -- -- -- -- -- -- -- vit esse estrany =E2=98=A3 spir.wikidot.com
Dec 30 2010
prev sibling parent Justin C Calvarese <jccalvarese gmail.com> writes:
== Quote from Daren Scot Wilson (darenw darenscotwilson.com)'s article
 I've been interested for a long time in learning D and using it for image
 processing and physics number crunching.  Now I've got a few days in a row
 to study.   Unfortunately I'm getting stuck even with "Hello World" due to
 most examples of D I find seem to be using Phobos instead of Tango.

Have you tried these examples: http://dsource.org/projects/tango/wiki/Tutorials (I'm not a Tango-user, but I'm pretty sure there are some good Tango examples on some web page.) If you'd be willing to spend some money, "Learn to Tango with D" is probably a good resource for learning Tango.
 Indeed, I'm not clear as to which is the best to use.  For me, "best" is
 defined primarily as "it works on my machine" but secondarily I care about
 speed and ease of use.
 I'm using LDC (the llvm-based compiler) because it's 64-bit and maybe can
 handle D2.   The D1/D2 doesn't matter a lot, though the statement "D version
 2 which is recommended for new projects" on the home page sways me to use
 D2.

If you want to stick with LDC/Tango, D2 isn't an option yet. I don't know if Tango will ever be ported to D2. Apparently LDC has experimental D2 support. According to its web page (http://dsource.org/projects/ldc): "D2 support is highly experimental (read: unusable)". It doesn't sound like a fun place for a new user to be IMHO.
 But 64 bit is vital, since I want to work on huge arrays.   The only
 limitation of LDC is apparently it works only with Tango.
 If I could rub a genie's lamp and have three wishes granted, they are:
 1) Is it possible to get the source and compile Phobos for use with LVM?

I won't say it's impossible, but I suspect it's non-trivial since I haven't heard that anyone has done it yet.
 2) Existing code examples should always indicate whether they use Tango or
 Phobos.  Ideally, every example would be presented twice, once for each.
 This might be redundant or pointless for old-timers and D experts, but for
 newbies like me it would help avoid wasting time.

Since Tango and Phobos for D2 seem to be diverging rather than converging, it's going to be increasingly difficult to write examples that do the same thing using both libraries. The example writer would basically be writing the 2 different examples in many cases. Some library writers target both Phobos and Tango, and I suspect it can be very frustrating.
 3)  I'd like to see a translation page with two columns, Phobos and Tango,
 showing how to do the most common things we all need to do - printf() or
 whatever, basic binary file i/o, etc. There could be a third column for C or
 C++ to help us C++ programmers make the transition.

That's not a bad idea for someone to do, but it's 3 times the effort of a single D example and requires knowledge of C++. You may find this wiki page helpful: http://www.prowiki.org/wiki4d/wiki.cgi?ComingFrom/CPlusPlus If dearth of Tango examples is a big concern of yours, I'd suggest that you consider starting off with D1 with Phobos (or D2 with Phobos if you're more adventurous). I don't know how vital 64-bit support is for you in the near term, but I know that Walter is working on 64-bit support for DMD. I don't know if 64-bit will be available for DMD in a couple months or if it'll take 6 months, but I know that he's working on it. I don't know the state of 64-bit in GDC, but it may be farther along than DMD (or it may be fully supported already). Anyway, it's your decision, and I suspect some other people will post even better advice than my few comments here. Good luck! jcc7
Dec 29 2010