Talk:D (programming language): Difference between revisions

Content deleted Content added
Not relevant to contents of article.
 
(131 intermediate revisions by 71 users not shown)
Line 1:
{{afd-merged-from|GtkD|GtkD|23 August 2011|date=August 2011}}
{{WikiProject Computer Science}}
 
{{archives}}
==Old discussion==
{{WikiProject banner shell |class=C |1=
"(This needs elaboration.)" has just turned into a link, the target of which has only one sentence of relevance, which says practically nothing.
{{WikiProject Computing |importance=Low |software=y |software-importance=Low |science=yes |science-importance=Low |free-software=yes |free-software-importance=Low}}
}}
 
==HelloWorld==
OK, so it gives a lower bound for the number of languages that have been called D, but that's certainly nowhere near an adequate elaboration in my mind.
Where is HelloWorld? <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/12.15.136.26|12.15.136.26]] ([[User talk:12.15.136.26|talk]]) 21:03, 14 October 2010 (UTC)</span><!-- Template:UnsignedIP --> <!--Autosigned by SineBot-->
:[http://rosettacode.org/wiki/Hello_world/Text#D D's Hello World] is pretty boring. I think it'd only waste space in the article. --[[User:CyberShadow|Vladimir]] ([[User talk:CyberShadow|talk]]) 01:05, 23 October 2010 (UTC)
::But all the others have HelloWorld. In VB it's just <code>MsgBox("Hello, World!")</code> but we still have it. --[[User:Joshua Issac|Joshua Issac]] ([[User talk:Joshua Issac|talk]]) 00:47, 15 November 2010 (UTC)
 
== Purity of mySum function in the "Functional" section (1.1.4) ==
Maybe someone should start [[D programming language (disambiguation)]]....
 
I am not a D programmer, so I may misunderstand the language's semantics, but I am confused about how the mySum function could be considered pure:
-- [[User:Smjg|Smjg]] 09:44, 20 Apr 2004 (UTC)
-----
Wouldn't it be slightly better to use a D-specific statement in the example like foreach instead of for ?
 
<syntaxhighlight lang="D">
The problem is that it won't have exactly the same output as the current example (you can't print the number of the argument unless you add an ''i'' variable somewhere and increment it each time, but that doesn't look very clean)
int main()
{
int[] a1 = [0,1,2,3,4,5,6,7,8,9];
int[] a2 = [6,7,8,9];
int pivot = 5;
pure int mysum(int a, int b) // pure function
{
if (b <= pivot) // ref to enclosing-scope
return a + b;
else
return a;
}
</syntaxhighlight>
 
The value mySum produces depends on the value of pivot from the enclosing scope. If the numerical value of pivot in mySum was fixed at the time mySum is defined, then mySum would be only depend on its arguments, and could arguably be called a pure function, but from what I infer from the section on nested functions on [http://www.digitalmars.com/d/2.0/function.htm the function page] of D's reference manual, the value of pivot in mySum is the value of pivot in the enclosing scope at the time mySum is called.
: D allows foreach loops to be indexed, so there's no problem at all. -- [[User:Smjg|Smjg]] 22:36, 3 Jul 2004 (UTC)
 
So I would expect that:
:: OK, I don't know D well enough :) and what do you think of my proposition then ? [[User:SeeSchloss|&rarr; SeeSchloß]] 20:44, 5 Jul 2004 (UTC)
 
<syntaxhighlight lang="D">
::: Yes, we should put this in. A good code example is one that does things in the way of the language. -- [[User:Smjg|Smjg]] 09:45, 6 Jul 2004 (UTC)
pivot = 4;
mySum(3, 5);
</syntaxhighlight>
would yield 3, but
 
<syntaxhighlight lang="D">
:::: Thanks, I've replaced the ''for'' example with the ''foreach'' one. By the way it looks like the new release now has writef() and writefln(), which could give ''writefln ("args[", i, "] = ", arg);'' instead of the printf in the example, but I haven't used it yet. [[User:SeeSchloss|&rarr; SeeSchloß]] 21:30, 10 Jul 2004 (UTC)
pivot = 5;
==Example==
mySum(3, 5);
</syntaxhighlight>
would yield 8
 
Unfortunately I don't have a D compiler installed on my computer, so I cannot check this myself. <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/67.168.77.169|67.168.77.169]] ([[User talk:67.168.77.169|talk]]) 08:16, 6 November 2010 (UTC)</span><!-- Template:UnsignedIP --> <!--Autosigned by SineBot-->
// D program to print 'hello world' followed by its command line arguments
int main(char[][] args)
{
printf("hello world\n");
foreach (int i, char[] arg; args)
printf("args[%d] = '%.*s'\n", i, arg);
return 0;
}
 
:The code indeed compiles. I think that the idea is that nested functions have a hidden argument - a pointer to their enclosing scope (main's local variables). However, that doesn't explain why the code continues to compile when pivot is moved outside main(), or if you add a call to a non-pure function in mySum - these sound like compiler bugs. --[[User:CyberShadow|Vladimir]] ([[User talk:CyberShadow|talk]]) 11:45, 6 November 2010 (UTC)
==The article reads like an advertisement for D==
 
I need to learn more before I can rework it, but for starters, "archaic features" is not [[Wikipedia:NPOV|NPOV]]. --[[User:Ardonik|Ardonik]] 00:43, Jul 16, 2004 (UTC)
 
::It does compile, but by default functions are (weakly) pure if they don't access any global or static mutable data. They are free to access non-mutable (i.e. const, immutable, or static initialized module / class / thread data) and non-global-non-static data, this includes the parent function data. To ensure somehow functional safety, one need strong purity, this can be done by marking a function as immutable, as well not using transitively mutable references in input and output arguments.
: yes, the article ends up being an advertisement for D instead of an impartial explanation of what it is, it's history and it's capabilities. Maybe it has something to do with D being still under development and some purveyors of that language being quite active in the astroturfing department.
: A complete impartial re-write of this article is needed.
 
<syntaxhighlight lang="D">
::Any input from a real-life D programmer would be more than welcome at this point. --[[User:Ardonik|[[User:Ardonik|Ardonik]]([[User talk:Ardonik|talk]])]] 03:23, Aug 31, 2004 (UTC)
int[] a1 = [0,1,2,3,4,5,6,7,8,9];
int[] a2 = [6,7,8,9];
int pivot = 5;
 
pure int mysum(int a, int b) immutable // pure function
:::I added the advertisement notice since:
{
:::* There's no criticism
if (b <= pivot) // ref to enclosing-scope
:::* There are sentences like ''OOP is supported, of course!''
return a + b;
:::* There is a list of ''Enhancements over C++'', but many of them may or may not be considered enhancements, such as: ''all vars automatically initialized to 0''. Some developers do NOT want them initialized to 0 since its a waste of CPU.
else
:::Unfortunately I'm not a D programmer so I'm not qualified for a rewrite :( --[[User:Swalot|Swalot]] 22:55, 18 September 2006 (UTC)
return a;
}
</syntaxhighlight>
::will not compile, and compiler will report the issue:
 
<syntaxhighlight lang="text">
::::I hope that I've cleaned up the issues you mentioned. However as for criticism, that might have to wait until v1.0 is released, which BTW is likely to be very soon. [[User:Derek Parnell|DerekP]] 23:42, 19 September 2006 (UTC)
a.d:10:18: error: immutable function 'a.main.mysum' cannot access mutable data 'pivot'
10 | if (b <= pivot) // ref to enclosing-scope
</syntaxhighlight>
 
::If the pivot is made const or immutable, it will compile. In this sense the function will become strongly pure, but only during current execution of the scope. The context will be takes implicitly. https://dlang.org/spec/function.html#pure-functions provides some extra details, but details of pure functions inside other functions is not really well explained. [[Special:Contributions/81.6.34.172|81.6.34.172]] ([[User talk:81.6.34.172|talk]]) 20:15, 29 April 2020 (UTC)
==There appears to be another growing language family called D==
Date & Darwen, in [[The Third Manifesto]], propose a category of pure-relational database languages called '''D'''. Their example language is called '''Tutorial D''', and there appear to be a number of implementations already under development. For one, see: http://dbappbuilder.sourceforge.net/Rel.html —[[User:Fubar Obfusco|FOo]] 04:01, 23 Sep 2004 (UTC)
 
== Pull the C# reference until examples? ==
== Proposed or possible ==
 
"Proposed or possible" successors to C++ is redundant. I'm going to change it back to just "proposed."
 
Given the way it reads, I'm not sure why C# is even listed without more direct examples as to what it inherited from C# that isn't already considered from Java (a predecessor).[[Special:Contributions/68.163.243.231|68.163.243.231]] ([[User talk:68.163.243.231|talk]]) 22:07, 12 November 2010 (UTC)
== Babel ==
 
== Misleading statement about C compatibility? ==
I've added D to the [[Wikipedia:Babel]] project. Feel free to put it in your babelbox! -- [[User:Smjg|Smjg]] 09:33, 27 October 2005 (UTC)
 
The second sentence under the Features section currently ends by saying "and as such [D] is not compatible with C/C++ source code". This sentence may be misleading given that D code can call libraries written in C. This is indeed discussed in more detail in the Interaction with Other Systems section. Should this statement be removed or clarified? [[User:Milez|Milez]] ([[User talk:Milez|talk]]) 20:57, 15 February 2013 (UTC)
==when created?==
When was it designed? [[User:71.96.234.140|71.96.234.140]] 04:20, 27 April 2006 (UTC)
 
== Explain the concurrent section ==
:Perhaps in 2001, based on [http://www.digitalmars.com/drn-bin/wwwnews?D/2 this post] from August 2001 being the earliest one there. The earliest version of D I can find mention of in the changelog was from September 2002. &ndash;[[User:Tifego|<small>Tifego</small>]]<sup>[[User Talk:Tifego|(t)]]</sup><sub> 04:35, 27 April 2006 (UTC)</sub>
::However, if you mean when was it initially thought of, this might apply: ''"D was conceived in December 1999 by Walter Bright as a reengineering of C and C++"''. &ndash;[[User:Tifego|<small>Tifego</small>]]<sup>[[User Talk:Tifego|(t)]]</sup><sub> 04:38, 27 April 2006 (UTC)</sub>
 
The section about concurrent programming only contains source code. Should there not be some sort of explanation to ''why'' it is concurrent and what the code does (besides from the very thin information in the comments)? [[User:SBareSSomErMig|SBareSSomErMig]] ([[User talk:SBareSSomErMig|talk]]) 10:22, 6 March 2013 (UTC)
== Example 3 ==
It's not clear in the comment which portions of Example 3 are or aren't part of C++ already. I don't know D at all, so could somebody clarify? [[User:Mkb218|matt kane&#39;s brain]] 13:50, 5 May 2006 (UTC)
 
== Another D programming language in the 1980ies ==
== D does not "extend" C++ ==
I remembered - and found out that I remembered correctly - that there was a language "D" for TSX-11 PDP-11 OS with preemptive multitasking, very good OS for its time. I think "D" was used for writing Lex-11. I have added a link under talk for TSX-11 wikipedia page.
--[[User:Donald j axel|d-axel]] ([[User talk:Donald j axel|talk]]) 04:13, 7 February 2016 (UTC)
Wikipedia mentions the other "D" programming language as "Filetab D".
--[[User:Donald j axel|d-axel]] ([[User talk:Donald j axel|talk]]) 04:15, 7 February 2016 (UTC)
 
== External links modified ==
To say that D extends C++ implies that D is C++ with more features. That's just wrong. Infact, that's the opposite of the spirit of D.
 
Hello fellow Wikipedians,
D does not "extend" C++; D re-engineers C++ in a better way.
D is a modern language that combines the robustness of modern languages (like Java and C#) with the power and features of C/C++.
 
I have just modified one external link on [[D (programming language)]]. Please take a moment to review [https://en.wikipedia.org/w/index.php?diff=prev&oldid=798650300 my edit]. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit [[User:Cyberpower678/FaQs#InternetArchiveBot|this simple FaQ]] for additional information. I made the following changes:
:Hmmmmmm, ... mmmm?? At least this container/dictionary stuff is somewhat original for the C-family proper. I'm not quite sure what D does, but it reworks the C-family of language by incorporating constructions of minimalist alternative "interpretations" (in linguists' sense). If the classes per default are non-virtual (statically allocked), then the nearest language is C++; however, if the classes are virtual (dynallocked), then the nearest language is in fact Objective C. I think D is developed from the C-family using experiences from C, C++, Objective C, Java, C-sharp and some other inspirations. To be more precise than that is to provide an erroneous image. <span style="color: #800000; background-color: #FFFFA0; padding: 1px 2px 3px 2px">''Said: [[User talk:Rursus|Rursus]] [[User:Rursus/OTHITPWMEEENAE|☺]] [[User:Rursus|★]]''</span> 09:28, 14 June 2007 (UTC)
*Added archive https://web.archive.org/web/20070224161328/http://ddbg.mainia.de/ to http://ddbg.mainia.de/
 
When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.
::Sorry, I think I spake balderdash! What I meant was that dynamical method lookup (by default) implies a nearer relationship with Obj-C, and statical same C++. Either way D is a general reelaboration on the basis of C-related PL:s, not more precize than that. <span style="color: #800000; background-color: #FFFFA0; padding: 1px 2px 3px 2px">''Said: [[User talk:Rursus|Rursus]] [[User:Rursus/OTHITPWMEEENAE|☺]] [[User:Rursus|★]]''</span> 13:47, 14 June 2007 (UTC)
 
{{sourcecheck|checked=false|needhelp=}}
== The current version is ... ==
 
Cheers.—[[User:InternetArchiveBot|'''<span style="color:darkgrey;font-family:monospace">InternetArchiveBot</span>''']] <span style="color:green;font-family:Rockwell">([[User talk:InternetArchiveBot|Report bug]])</span> 03:22, 3 September 2017 (UTC)
There is no indication of the current version of either the compiler (or the tools). This information would be useful in determining how "ready is D for prime time." [[User:24.188.206.103|24.188.206.103]] 00:56, 13 July 2006 (UTC)Cacofonix
 
== what became of the merger of the articles on gtkd and the d programming language? ==
<small>—The preceding [[Wikipedia:Sign your posts on talk pages|unsigned]] comment was added by [[User:209.89.183.89|209.89.183.89]] ([[User talk:209.89.183.89|talk]] • [[Special:Contributions/209.89.183.89|contribs]]) {{{2|}}}.</small>
: So fix the article [[User:Mkb218|matt kane&#39;s brain]] 21:31, 12 June 2006 (UTC)
 
At the top of the talk page, there's this prominent notice:
==DTrace==
'''The article GtkD was nominated for deletion. The discussion was closed on 23 August 2011 with a consensus to merge the content into D (programming language). If you find that such action has not been taken promptly, please consider assisting in the merger instead of re-nominating the article for deletion. To discuss the merger, please use this talk page.'''
The [[DTrace]] kernel tracing mechanism uses a "scripting language" also called "D", that appears to be a different language than the one covered in this article. I think there should be at least some mention of it, as DTrace is probably more current as a topic than this "older" language. More info on dtrace can be found [[http://www.opensolaris.org/os/community/dtrace/|here]], as well as some [[http://users.tpg.com.au/adsln4yb/DTrace/seeksize.d|sample code]]. --[[User:Booch|Booch]] 06:35, 8 November 2006 (UTC)
 
August 23, 2011 is not quite 10 years ago. There's no mention of gtkd in the article, that i can see; the string 'gtkd' itself redirects to the article on gtk.
==Requested move==
[[D programming language]] → [[D (programming language)]]
– Conformance with WP naming conventions [[User:Atanamir|atanamir]]
{{Wikipedia talk:WikiProject Programming languages/Renaming poll}}
 
Per the notice, this is the right place to discuss the merger. Did it ever happen, or was mention of gtkd just washed away through a string of edits over time?
==D influenced by C#?==
Recently, C# was added to the list of influences of D ([http://en.wikipedia.org/w/index.php?title=D_%28programming_language%29&curid=243881&diff=87451030&oldid=87314214 diff]). However, I think that is not the case, since D got started before C# had gained a considerable momentum &ndash; I think the languages are similar since they merely have common ancestors. Any opinions? -- [[User:Intgr|intgr]] 10:41, 13 November 2006 (UTC)
:I added that because I recall discussions with Walter Bright saying things that indicated that some concepts now found in D are also found in C#. These were things not originally in D but have made their way into the current specification after being proposed for C# (3.0 from memory). I'll try to locate the discussions and post references.
 
[[User:Son of eugene|Son of eugene]] ([[User talk:Son of eugene|talk]]) 20:03, 25 June 2021 (UTC)
==IDE for D available==
I'm the author of Geany, a light IDE which supports the language D. Geany isn't a full-featured IDE and it's still in heavy development but it supports already D with some auto completion, folding and such things. Perhaps someone wants to add it. <small>—The preceding [[Wikipedia:Sign your posts on talk pages|unsigned]] comment was added by [[Special:Contributions/80.144.60.98|80.144.60.98]] ([[User talk:80.144.60.98|talk]]) 17:33, 8 December 2006 (UTC).</small><!-- HagermanBot Auto-Unsigned -->
 
== ...builtInfluenced makingGo? theI DMDdo compilernot frontthink end..sol. ==
 
In a top infobox, I see that D influenced Go.
I'm not a native English speaker, so I probably just don't get it.
<blockquote>''Gnu D Compiler (GDC): the GNU D Compiler, built making the DMD compiler front end and the GCC compiler back end work together.''</blockquote>
Is it correct that Gnu D uses part of the DMD compiler? I can not find a confirmation of that. - [[:ru:User:Saproj]] <small>—The preceding [[Wikipedia:Sign your posts on talk pages|unsigned]] comment was added by [[Special:Contributions/89.106.39.140|89.106.39.140]] ([[User talk:89.106.39.140|talk]]) 19:30, 15 January 2007 (UTC).</small><!-- HagermanBot Auto-Unsigned -->
:I haven't followed it for a little while, but from memory, the DMD release comes with source code for the compiler front end. DMD itself utilize the DMC compiler for the backend whose source are not release. GDC take that front end source and make it work with GCC, so yes is the answer to your question. -- [[User:KTC|KTC]] 17:37, 15 March 2007 (UTC)
 
I find this doubtful.
== Changes are made regularly? ==
 
D influenced some languages, including modern C++, Nim, etc. But I really doubt it influenced Go in anyway at all. Go has completely different execution model, typing system, syntax, no templates, different module system, different concurrency methods, different error control, no metaprogramming. I would be super hard to find ANY concept taken from D that got into Go.
There is this in the article:
<blockquote> D is still under development, and changes to the language are made regularly. Although the design is almost frozen, it is possible that some of these changes could break D programs written for older versions of the language and compiler. </blockquote>
 
The only thing vaguely similar is Go and D compilers speed, which were kind of new at the time (currently many other compiled languages like Zig and Nim are even faster in this regard). But modern D is much slower than Go in compilation area (partially due to D standard libraries growing big). Even if so, this is hardly an influence of any kind. [[Special:Contributions/2A02:168:F609:1:BEDA:2803:4006:38FD|2A02:168:F609:1:BEDA:2803:4006:38FD]] ([[User talk:2A02:168:F609:1:BEDA:2803:4006:38FD|talk]]) 17:38, 5 March 2023 (UTC)
I find this strange, because, the article mentions that D already hit 1.0. Can somebody more knowledgeable about D verify this issue? [[User:JorgePeixoto|Jorge Peixoto]] 10:37, 15 March 2007 (UTC)
:After thinking a bit more about this. There is one feature in Go which is very similar to D. That pointer and reference dereferences, all use dot, instead of arrow for pointers and dot for references or values. I am not sure if this was influenced by D tho. [[Special:Contributions/2A02:168:F609:1:BEDA:2803:4006:38FD|2A02:168:F609:1:BEDA:2803:4006:38FD]] ([[User talk:2A02:168:F609:1:BEDA:2803:4006:38FD|talk]]) 18:34, 5 March 2023 (UTC)
 
== usage of 'mathematical corellaries' ==
:That was written prior to the 1.0 release, and nobody has just changed it yet. -- [[User:Intgr|intgr]] 14:57, 15 March 2007 (UTC)
 
the fifth paragraph under Features reads "Specific operators for string handling exist, '''visually''' distinct from '''mathematical corellaries'''".
: In the end, 1.0 was little more than a symbolic milestone. Things haven't really changed since then. -- [[User:Smjg|Smjg]] 16:53, 15 March 2007 (UTC)
i believe this should be changed to something like "'''syntactically''' distinct from '''numerical operators'''", or just removed from the paragraph because:
 
- "visually" might be ableist. "syntactically" might also be more correct, as programming languages arent defined over what they visually look like, but in terms of (also) their syntax.
I changed the text to reflect was is in fact going on. --[[User:Marianocecowski|Mariano]]<small>([[User talk:Marianocecowski|t]]/[[Special:Contributions/Marianocecowski|c]])</small> 17:20, 15 March 2007 (UTC)
 
- the word "cor'''e'''llaries" seems to be a typo of "cor'''o'''llaries". a naive google search for "corellaries" turns up very few results (this page is the top result btw). wiktionary has no entry for it either.
== Examples in RGB?? ==
OK, no trouble for me, because my color vision is virtually perfect, but there are color blindness out there. I suggest using other kind of highlight based on <span style="background-color: white">background</span> and '''font style'''! <span style="color: #800000; background-color: #FFFFA0; padding: 1px 2px 3px 2px">''Said: [[User talk:Rursus|Rursus]] [[User:Rursus/OTHITPWMEEENAE|☺]] [[User:Rursus|★]]''</span> 15:00, 14 June 2007 (UTC)
 
- even if we correct it to "corollary" the phrase still is wrong. "mathematical corollaries" have nothing to do with the rest of the paragraph or page. the reference material for the phrase does not contain the words "corollaries" or "corellaries". i have no idea how this word ended up here.
:Syntax highlighting with font color is a very established practice &mdash; anything else will probably appear unnatural and distracting to programmers; even the colors (blue for keywords, red for literals, green for comments) are a de facto standard for C-like languages.
:Do you really think there is a good reason to change this? -- [[user:intgr|intgr]]&nbsp;<sup>[[user talk:intgr|#%@!]]</sup> 10:06, 15 June 2007 (UTC)
 
- string operators, in a sense, can also be called "mathematical operators". strings of characters can be defined and studied mathematically. [[Special:Contributions/187.61.153.177|187.61.153.177]] ([[User talk:187.61.153.177|talk]]) 00:10, 15 January 2024 (UTC)
== Features section, comments on backwards compatibility with C ==
 
:@[[User:187.61.153.177|187.61.153.177]] - [[Help:Editing|Do it. There is nothing or no-one stopping you]], as long as you are trying to improve the encyclopedia. I would recommend implementing the first sentence of what you said. You probably won't see this, but [[WP:BOLD|you can do it]]. <span style="font-family:monospace;background:#368;padding:.2rem;color:white">''[[User:APenguinThatIsSilly|<span style="color:white">APenguinThatIsSilly</span>]]''(''[[User talk:APenguinThatIsSilly|<span style="color:#FEC">"talk"</span>]]'')</span> 21:13, 14 January 2025 (UTC)
Regarding the following quote from the Features section: "D is being designed with lessons learned from practical C++ usage rather than from a theoretical perspective. ''It uses many C++ concepts but discards some, such as strict backwards compatibility with C source code.''" [My emphasis.]
 
Could the person who wrote it clarify their meaning here? C++ is not strictly backwards compatible with C anyway. Consider e.g. the statement,
 
int *a = malloc(10*sizeof(int));
 
which is legitimate in C but not C++. Is the intent to mean compatibility with C system calls, or ability to link with C libraries, or is the paragraph just plain wrong? &mdash;[[User:WebDrake|WebDrake]] 18:17, 14 June 2007 (UTC)
 
:Good point. I think the intention was to say that while D is based on the concepts and their implementation in C++, and thus C to some large degree, it is not bound to the idea of strict backwards compatibility with either C or C++. [[User:Derek Parnell|DerekP]] 08:03, 18 June 2007 (UTC)