Talk:D (programming language)
![]() | 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. Do not remove this template after completing the merger. A bot will replace it with {{afd-merged-from}}. |
|
|
![]() | Computing Start‑class | |||||||||
|
![]() | Computer science Start‑class Low‑importance | ||||||||||||||||
|
HelloWorld
Where is HelloWorld? —Preceding unsigned comment added by 12.15.136.26 (talk) 21:03, 14 October 2010 (UTC)
- D's Hello World is pretty boring. I think it'd only waste space in the article. --Vladimir (talk) 01:05, 23 October 2010 (UTC)
- But all the others have HelloWorld. In VB it's just
MsgBox("Hello, World!")
but we still have it. --Joshua Issac (talk) 00:47, 15 November 2010 (UTC)
- But all the others have HelloWorld. In VB it's just
Purity of mySum function in the "Functional" section (1.1.4)
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:
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;
}
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 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.
So I would expect that:
pivot = 4;
mySum(3, 5);
would yield 3, but
pivot = 5;
mySum(3, 5);
would yield 8
Unfortunately I don't have a D compiler installed on my computer, so I cannot check this myself. —Preceding unsigned comment added by 67.168.77.169 (talk) 08:16, 6 November 2010 (UTC)
- 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. --Vladimir (talk) 11:45, 6 November 2010 (UTC)
Pull the C# reference until examples?
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).68.163.243.231 (talk) 22:07, 12 November 2010 (UTC)
Misleading statement about C compatibility?
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? Milez (talk) 20:57, 15 February 2013 (UTC)
Explain the concurrent section
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)? SBareSSomErMig (talk) 10:22, 6 March 2013 (UTC)
Type naming policy
I don't think it's future proof name types way they are named currently.
void - no type bool false boolean value byte 0 signed 8 bits ubyte 0 unsigned 8 bits short 0 signed 16 bits ushort 0 unsigned 16 bits int 0 signed 32 bits uint 0 unsigned 32 bits long 0L signed 64 bits ulong 0L unsigned 64 bits cent 0 signed 128 bits (reserved for future use) ucent 0 unsigned 128 bits (reserved for future use) float float.nan 32 bit floating point double double.nan 64 bit floating point real real.nan largest FP size implemented in hardware (Implementation Note: 80 bits for x86 CPUs or double size, whichever is larger) ifloat float.nan*1.0i imaginary float idouble double.nan*1.0i imaginary double ireal real.nan*1.0i imaginary real cfloat float.nan+float.nan*1.0i a complex number of two float values cdouble double.nan+double.nan*1.0i complex double creal real.nan+real.nan*1.0i complex real char 0xFF unsigned 8 bit UTF-8 wchar 0xFFFF unsigned 16 bit UTF-16 dchar 0x0000FFFF unsigned 32 bit UTF-32
This would be way better naming...
void - no type bool false boolean value s8int 0 signed 8 bits u8int 0 unsigned 8 bits s16int 0 signed 16 bits u16int 0 unsigned 16 bits s32int 0 signed 32 bits u32int 0 unsigned 32 bits s64int 0L signed 64 bits u64int 0L unsigned 64 bits s128int 0 signed 128 bits (reserved for future use) u128int 0 unsigned 128 bits (reserved for future use) sLint 0 largest signed integer implemented in hardware uLint 0 largest unsigned integer implemented in hardware n32float float.nan 32 bit floating point n64float double.nan 64 bit floating point nLfloat real.nan largest FP size implemented in hardware (Implementation Note: 80 bits for x86 CPUs or double size, whichever is larger) i32float float.nan*1.0i imaginary float i64float double.nan*1.0i imaginary double iLfloat real.nan*1.0i imaginary real c32float float.nan+float.nan*1.0i a complex number of two float values c64float double.nan+double.nan*1.0i complex double cLfloat real.nan+real.nan*1.0i complex real b8char 0xFF unsigned 8 bit UTF-8 b16char 0xFFFF unsigned 16 bit UTF-16 b32dchar 0x0000FFFF unsigned 32 bit UTF-32
Also I added two more there, "largest (un)signed integer implemented in hardware".
triedoutd 188.238.70.207 (talk) 15:40, 4 September 2013 (UTC)