www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Progopedia - encyclopedia of programming languages

reply Walter Bright <newshound1 digitalmars.com> writes:
Does someone want to write a D entry?

http://progopedia.com/
Nov 23 2009
next sibling parent Walter Bright <newshound1 digitalmars.com> writes:
Walter Bright wrote:
 Does someone want to write a D entry?
 
 http://progopedia.com/
Forgot the reddit link: http://www.reddit.com/r/programming/comments/a79yr/progopedia_free_encyclopedia_of_programming/
Nov 23 2009
prev sibling next sibling parent Walter Bright <newshound1 digitalmars.com> writes:
Walter Bright wrote:
 Does someone want to write a D entry?
 
 http://progopedia.com/
Looks like we've got a D page now! Thanks, JMRyan! http://progopedia.com/language/d/
Nov 23 2009
prev sibling next sibling parent reply JMNorris <nospam nospam.com> writes:
Walter Bright <newshound1 digitalmars.com> wrote in news:heetio$be1$1
 digitalmars.com:

 Does someone want to write a D entry?
 
 http://progopedia.com/
Okay. I added a D entry. It should be checked for accruacy. I haven't added programming examples yet; I'll add at least the three example types shown on at http://progopedia.com/ (Hello world, Factorial, Fibonacci).
Nov 23 2009
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
JMNorris wrote:
 Walter Bright <newshound1 digitalmars.com> wrote in news:heetio$be1$1
  digitalmars.com:
 
 Does someone want to write a D entry?

 http://progopedia.com/
Okay. I added a D entry. It should be checked for accruacy. I haven't added programming examples yet; I'll add at least the three example types shown on at http://progopedia.com/ (Hello world, Factorial, Fibonacci).
Excellent, thanks JMNorris! This is exactly the kind of publicity D needs now. Andrei
Nov 23 2009
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Andrei Alexandrescu wrote:

 Okay.  I added a D entry.  It should be checked for accruacy.  I 
 haven't added programming examples yet; I'll add at least the three 
 example types shown on at http://progopedia.com/ (Hello world, 
 Factorial, Fibonacci).
Excellent, thanks JMNorris! This is exactly the kind of publicity D needs now.
Strangely, the Hello World program is not the one that is in D: import std.c.stdio; int main(char[][] args) { printf("hello world\n"); printf("args.length = %d\n", args.length); for (int i = 0; i < args.length; i++) printf("args[%d] = '%s'\n", i, cast(char *)args[i]); return 0; } But instead some half-way variant of the updated version for D: import std.stdio; void main(string[] args) { writefln("hello world"); foreach(string arg; args) writefln("%s", arg); } Otherwise I think that is a good example of the differences, even though it doesn't cover puts/writeln or handle errors... And of course it makes a couple of assumptions such as the terminal being in UTF-8. But I guess that's a Windows issue ? --anders PS. I think I call that program "echo" rather than "hello". Even had a first version "nothing" that prints nothing: http://gdcmac.sourceforge.net/GettingStarted.pdf (Mac) http://gdcwin.sourceforge.net/GettingStarted.pdf (Win)
Nov 23 2009
parent reply JMRyan <nospam nospam.com> writes:
Anders F Björklund <afb algonet.se> wrote in news:heg2ls$2j6v$1
 digitalmars.com:

Thank you for your suggestions below.

 Strangely, the Hello World program is not the one that is in D:
I don't understand. You appear to be referring a connonical or otherwise previously publish version fo D. Or perhaps I misunderstood you.
 But instead some half-way variant of the updated version for D:
 
 import std.stdio;
 
 void main(string[] args)
 {
      writefln("hello world");
      foreach(string arg; args)
          writefln("%s", arg);
 }
Progopedia specifies that the program should write "Hello, World!" to the display (prsumably the terminal). Echoing additional command line arguments is out of spec. Do you have a full-way variant for me to look at? Is what you have in mind for a full-way variant the suggestions below? Or do you have something else in mind?
 
 Otherwise I think that is a good example of the differences,
 even though it doesn't cover puts/writeln or handle errors...
I didn't use writeln() because it is not available in D1. I added a note about that. Looking at other examples on Progopedia, it seems that puts() is beyond the scope of the article. It sort of handles errors: writefln throws. I don't trap thrown errors, but that seems okay for this example.
 And of course it makes a couple of assumptions such as the
 terminal being in UTF-8. But I guess that's a Windows issue ?
Actually, it makes a much safer assumption, namely that, whatever character set the terminal uses, it' ASCII compatible. I suppose it might have some trouble with an EBCDIC terminal. I suppose that's a good thing. :-) More troubling, I'm assuming the terminal is not UTF-16 or UTF-32. Worrying about this seems to be beyond the scope of the Progopedia article. Thanks again for your suggestions.
Nov 24 2009
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
JMRyan wrote:

 I don't understand.  You appear to be referring a connonical or otherwise 
 previously publish version fo D.  Or perhaps I misunderstood you.
I meant the canonical samples/d/hello.d as in the DMD distributions.
 I didn't use writeln() because it is not available in D1.  I added a note 
 about that.  Looking at other examples on Progopedia, it seems that puts() 
 is beyond the scope of the article.
Probably right. Same goes for adding Tango, quickly gets complicated.
 And of course it makes a couple of assumptions such as the
 terminal being in UTF-8. But I guess that's a Windows issue ?
Actually, it makes a much safer assumption, namely that, whatever character set the terminal uses, it' ASCII compatible. I suppose it might have some trouble with an EBCDIC terminal. I suppose that's a good thing. :-) More troubling, I'm assuming the terminal is not UTF-16 or UTF-32. Worrying about this seems to be beyond the scope of the Progopedia article.
If one is echoing parameters back (which normal "hello" is not), then there was a D problem with terminals that are not UTF-8: $ ./echo hallå världen ./echo Error: 4invalid UTF-8 sequence But it doesn't apply to this Progopedia "hello" but only to the D "hello", so never mind me muddying up the waters in this thread. --anders
Nov 24 2009
prev sibling next sibling parent reply "Phil Deets" <pjdeets2 gmail.com> writes:
On Mon, 23 Nov 2009 17:40:06 -0500, JMNorris <nospam nospam.com> wrote:

 Walter Bright <newshound1 digitalmars.com> wrote in news:heetio$be1$1
  digitalmars.com:

 Does someone want to write a D entry?

 http://progopedia.com/
Okay. I added a D entry. It should be checked for accruacy. I haven't added programming examples yet; I'll add at least the three example types shown on at http://progopedia.com/ (Hello world, Factorial, Fibonacci).
On the C++ page, I see: Physical (shallow) equality a == b Physical (shallow) inequality a != b Deep equality *a == *b (a and b are pointers) Deep inequality *a != *b (a and b are pointers) On the D page, I see: Physical (shallow) equality x == y Physical (shallow) inequality x != y Deep equality x is y Deep inequality x !is y I'm not sure which is right, but I don't think they can both be right as "x is y" is more like "x == y" in C++ than "*x == *y". I might be wrong here; as I am a bit confused about this. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Nov 23 2009
parent reply BCS <none anon.com> writes:
Hello Phil,

 On the C++ page, I see:
 
 Physical (shallow) equality	a == b
 Physical (shallow) inequality	a != b
 Deep equality	*a == *b (a and b are pointers)
 Deep inequality	*a != *b (a and b are pointers)
 On the D page, I see:
 
 Physical (shallow) equality	x == y
 Physical (shallow) inequality	x != y
 Deep equality	x is y
 Deep inequality	x !is y
 I'm not sure which is right, but I don't think they can both be right
 as  "x is y" is more like "x == y" in C++ than "*x == *y". I might be
 wrong  here; as I am a bit confused about this.
 
I think you are correct "is" in D does to pointers what "==" does in C++.
Nov 23 2009
parent JMRyan <nospam nospam.com> writes:
BCS <none anon.com> wrote in 
news:a6268ffd5508cc3a873791ae4c news.digitalmars.com:

 I'm not sure which is right, but I don't think they can both be right
 as  "x is y" is more like "x == y" in C++ than "*x == *y". I might be
 wrong  here; as I am a bit confused about this.
I think you are correct "is" in D does to pointers what "==" does in C++.
Fixed. PS. I have posted here in the past as JMNorris, but resistered at Progopedia as JMRyan. So, except for one mistake, I've posted in this thread as JMRyan. Sorry for the confusing sock-puppetry--nothing nefarious is intended.
Nov 23 2009
prev sibling parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
JMNorris wrote:
 Walter Bright <newshound1 digitalmars.com> wrote in news:heetio$be1$1
  digitalmars.com:
 
 Does someone want to write a D entry?

 http://progopedia.com/
Okay. I added a D entry. It should be checked for accruacy. I haven't added programming examples yet; I'll add at least the three example types shown on at http://progopedia.com/ (Hello world, Factorial, Fibonacci).
Cool. I think the "For each value in a numeric range, 1 increment" can be replaced by: foreach(i; 0 .. limit) statement and the other with foreach_reverse(i; 0 .. limit) statement but these only work for D2 and probably some people here won't like the foreach_reverse version.
Nov 24 2009
parent JMRyan <nospam nospam.com> writes:
Ary Borenszweig <ary esperanto.org.ar> wrote in
news:heg99k$6ri$1 digitalmars.com: 


 I think the "For each value in a numeric range, 1 increment" can be 
 replaced by:
 
    foreach(i; 0 .. limit) statement
 
 and the other with
 
    foreach_reverse(i; 0 .. limit) statement
 
 but these only work for D2 and probably some people here won't like
 the foreach_reverse version.
Thanks for the suggestion. To accommodate this, I would need to divide D1 and D2 into separate languages. For example, Progopedia would require that K&R C, C89, C85, and C99 be listed as separate languages. Versions in Progopedia are versions of an implementation. Thus, e.g., GCC 4.4.2 and GCC 4.4.1 would be separate versions. Indeead the GCC listing is (in theory) out of date at 4.2.4. It makes sense in an absurd sort of way. None of the other languages on Progopedia go in for this level of detail. Indeead the GCC listing is (in theory) out of date at 4.2.4.
Nov 24 2009
prev sibling next sibling parent reply Michael Mittner <m.mittner shebang.at> writes:
 A K&R type book for D, “The D Programming Languageâ€, written by Andrei 
Alexandrescu and published by Addison-Wesley Professional is scheduled for publication in May 1010. D has come a long way!
Nov 23 2009
parent Ary Borenszweig <ary esperanto.org.ar> writes:
Michael Mittner wrote:
 A K&R type book for D, “The D Programming Languageâ€, written by Andrei 
Alexandrescu and published by Addison-Wesley Professional is scheduled for publication in May 1010. D has come a long way!
It time travelled to the past!
Nov 24 2009
prev sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
This is a similar site, with a lot more things (many programs are done by downs
and me):
http://rosettacode.org/wiki/Category:D

Another similar site, that recently has lost most of its contents, and now it
is rebuilding itself:
http://www.codecodex.com/wiki/Category:D

This is empty, but I'd like to see some D versions:
http://en.literateprograms.org/Category:Programming_language:D

Bye,
bearophile
Nov 23 2009
parent JMRyan <nospam nospam.com> writes:
bearophile <bearophileHUGS lycos.com> wrote in
news:hef5hl$qrf$1 digitalmars.com: 

 This is a similar site, with a lot more things (many programs are done
 by downs and me): http://rosettacode.org/wiki/Category:D
Wow, all those programs in Rosetta Code and no hello world? :-) It looks like you and downs have done lots of good work.
Nov 23 2009