Jump to page: 1 2
Thread overview
Please stop polluting D 2.0 with C/C++ programmer assumptions.
Nov 29, 2007
Craig Black
Nov 30, 2007
Dejan Lekic
Nov 30, 2007
Jan Claeys
Nov 29, 2007
Walter Bright
Nov 30, 2007
Jan Claeys
Nov 30, 2007
Walter Bright
Dec 01, 2007
Aziz K.
Dec 01, 2007
bearophile
Dec 03, 2007
Walter Bright
Dec 03, 2007
Aziz K.
Nov 29, 2007
Bill Baxter
Nov 29, 2007
Walter Bright
Nov 30, 2007
Dan
November 29, 2007
Hi Walter (and NG).

I've been trying to follow the NG lately (which is fairly time consuming) and I really only have one thing to say:

1) Remove the support for C style declaration.
2) Make suffix const the only way to declare a const method.
3) Stop assuming C++ programmers wants D to feel like C++.
4) Please...

This stuff is killing me! For the first time in D2.0 history I'm feeling it's on the right track, but things like:

class C {
	const const int[] func();
}

class ClassInfo {
	void (*classInvariant)(Object);
}

int array[1][2][3];

... just reminds me that actually it's not.

My 2 cents!

- Tomas Lindquist Olsen
November 29, 2007
"Tomas Lindquist Olsen" <tomas@famolsen.dk> wrote in message news:fimmh9$him$1@digitalmars.com...
> Hi Walter (and NG).
>
> I've been trying to follow the NG lately (which is fairly time consuming) and I really only have one thing to say:
>
> 1) Remove the support for C style declaration.

If you are talking about C style declaration for array types I think D 1.0 has this feature as well.  I think Walter wants it to be friendlier for C++ folks so there will hopefully be more converts.  It does clutter the language a little but it's not a big deal IMO.

> 2) Make suffix const the only way to declare a const method.

I don't know why Walter allows prefix const for methods.  It is a little confusing IMO.

> 3) Stop assuming C++ programmers wants D to feel like C++.
> 4) Please...
>
> This stuff is killing me! For the first time in D2.0 history I'm feeling it's on the right track, but things like:
>
> class C {
> const const int[] func();
> }
>
> class ClassInfo {
> void (*classInvariant)(Object);
> }

What is this about anyway?  I don't understand it's significance.

>
> int array[1][2][3];
>
> ... just reminds me that actually it's not.
>
> My 2 cents!
>
> - Tomas Lindquist Olsen


November 29, 2007
Craig Black wrote:
> "Tomas Lindquist Olsen" <tomas@famolsen.dk> wrote in message 
>>
>> 1) Remove the support for C style declaration.
> 
> If you are talking about C style declaration for array types I think D 1.0 has this feature as well.  I think Walter wants it to be friendlier for C++ folks so there will hopefully be more converts.  It does clutter the language a little but it's not a big deal IMO.
> 

Also function pointer declarations. Yes I know this is already in D 1.0, but that doesn't make it right IMHO.

>> 2) Make suffix const the only way to declare a const method.
> 
> I don't know why Walter allows prefix const for methods.  It is a little confusing IMO.
> 

Very confusing IMHO.

>> 3) Stop assuming C++ programmers wants D to feel like C++.
>> 4) Please...
>>
>> This stuff is killing me! For the first time in D2.0 history I'm feeling it's on the right track, but things like:
>>
>> class C {
>> const const int[] func();
>> }
>>
>> class ClassInfo {
>> void (*classInvariant)(Object);
>> }
> 
> What is this about anyway?  I don't understand it's significance.
> 

It was just some code examples of things I really dislike.

IMHO all this stuff just complicate the language (think frontend implementors). Also it means that probably someone will use it. Can't help but feel sorry for the D coders reading that code who do *not* come from a C/C++ background.
November 29, 2007
Tomas Lindquist Olsen wrote:
> I've been trying to follow the NG lately (which is fairly time consuming) and I really only have one thing to say:
> 
> 1) Remove the support for C style declaration.
> 2) Make suffix const the only way to declare a const method.
> 3) Stop assuming C++ programmers wants D to feel like C++.
> 4) Please...
> 
> This stuff is killing me! For the first time in D2.0 history I'm feeling it's on the right track, but things like:
> 
> class C {
>     const const int[] func();
> }
> 
> class ClassInfo {
>     void (*classInvariant)(Object);
> }
> 
> int array[1][2][3];
> 
> ... just reminds me that actually it's not.
> 
> My 2 cents!

1) The C style array declarations have been in D since day 1 :-), they aren't a problem to support in the compiler, and are essentially under the radar. And I know from experience that they really do help in translating C code to D.

2) I had this implemented for a while. The problem is, it sucks. Take a look at Object:

class Object
{
    void print();
    string toString();
    hash_t toHash();
    int opCmp(Object o);
    int opEquals(Object o);
}

All these member functions need to be const. Would you rather write:

class Object
{
    void print() const;
    string toString() const;
    hash_t toHash() const;
    int opCmp(Object o) const;
    int opEquals(Object o) const;
}

or:

class Object
{
  const:
    void print();
    string toString();
    hash_t toHash();
    int opCmp(Object o);
    int opEquals(Object o);
}

I'm pretty confident the latter style is much easier on the eyes. It also makes for a very visually appealing way to segregate the const member functions from the mutating ones. If you've ever looked at a complex C++ class, all the const's sprinkled liberally through the declarations just make for an ugly, confusing mish-mash.

3) Half of D programmers come from C++. Similarities between the two make for much quicker adaption to D.
November 29, 2007
Tomas Lindquist Olsen wrote:
> Hi Walter (and NG).
> 
> I've been trying to follow the NG lately (which is fairly time consuming) and I really only have one thing to say:
> 
> 1) Remove the support for C style declaration.
> 2) Make suffix const the only way to declare a const method.
> 3) Stop assuming C++ programmers wants D to feel like C++.
> 4) Please...
> 
> This stuff is killing me! For the first time in D2.0 history I'm feeling it's on the right track, but things like:
> 
> class C {
>     const const int[] func();
> }

That one is a syntax error.  Should be

class C {
    const const(int[]) func();
}

But I don't understand the logic of 3)"don't assume C++ folks want D to look like C++" and 2)"make suffix const the only way [like C++]".  It seems like a mild contradiction.

--bb
November 29, 2007
Bill Baxter wrote:
> But I don't understand the logic of 3)"don't assume C++ folks want D to look like C++" and 2)"make suffix const the only way [like C++]".  It seems like a mild contradiction.

It's not possible to design a language that is free of conflicting goals :-)
November 30, 2007
Walter Bright Wrote:

> Bill Baxter wrote:
> > But I don't understand the logic of 3)"don't assume C++ folks want D to look like C++" and 2)"make suffix const the only way [like C++]".  It seems like a mild contradiction.
> 
> It's not possible to design a language that is free of conflicting goals :-)

Read again.  It's not a contradiction.
No other opinions on this subject.  I didn't read it.  I'm just passing through.
November 30, 2007
Do I understand this thread correctly? - A frontend implementor is whining for language specification to be changed because implementing a frontend for the current language spec. is more difficult?
November 30, 2007
Op Fri, 30 Nov 2007 02:14:09 +0000, schreef Dejan Lekic:

> Do I understand this thread correctly? - A frontend implementor is whining for language specification to be changed because implementing a frontend for the current language spec. is more difficult?

Considering that Walter often mentions the complexity of implementing certain C++ constructs correctly as a rationale for certain decisions in D's design, I suppose that would be a good reason to whine about D2's proposed design too...   ;-)



-- 
JanC
November 30, 2007
Op Thu, 29 Nov 2007 12:34:01 -0800, schreef Walter Bright:

> 3) Half of D programmers come from C++. Similarities between the two make for much quicker adaption to D.

But it also means that more confusion is likely to happen about those things that are slightly-different-but-almost-the-same...


-- 
JanC
« First   ‹ Prev
1 2