View mode: basic / threaded / horizontal-split · Log in · Help
June 19, 2007
Re: Huh, invariant() {...} ?
On Mon, 18 Jun 2007 11:25:32 -0700, Walter Bright wrote:

> Kristian Kilpi wrote:
>> 
>> This is a small detail, but I found myself wondering why the class 
>> invariant declarations have now parenthesis (in 2.0, that is).
> 
> It was to remove syntactical ambiguities.

... at the cost of understanding for humans ... 

The "overloaded" keyword problem with D is just getting worse and worse. 

I know you are a compiler writer and doing such things as you are makes it
easier for the compiler, but the continually overloading of keywords with
different (but similar) meanings in D is bordering on the illegible. What
you are doing, inadvertently, is making D harder for people to learn,
understand, and read.


-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Justice for David Hicks!"
19/06/2007 12:02:06 PM
June 19, 2007
Re: Huh, invariant() {...} ?
On Tue, 19 Jun 2007 05:06:08 +0300, Derek Parnell  
<derek@nomail.afraid.org> wrote:

> On Mon, 18 Jun 2007 11:25:32 -0700, Walter Bright wrote:
>
>> Kristian Kilpi wrote:
>>>
>>> This is a small detail, but I found myself wondering why the class
>>> invariant declarations have now parenthesis (in 2.0, that is).
>>
>> It was to remove syntactical ambiguities.
>
>  ... at the cost of understanding for humans ...
>
> The "overloaded" keyword problem with D is just getting worse and worse.
>
> I know you are a compiler writer and doing such things as you are makes  
> it
> easier for the compiler, but the continually overloading of keywords with
> different (but similar) meanings in D is bordering on the illegible. What
> you are doing, inadvertently, is making D harder for people to learn,
> understand, and read.
>

I agree.

(I have a feeling that Walter is reluctant to do something like this, but)  
if the keyword for the class invariants will be changed, I vote for:

  invarianttest

It's similar to 'unittest', and who knows, maybe there will be structure  
invariants someday also.
June 28, 2007
Re: Huh, invariant() {...} ?
Derek Parnell wrote:
> The "overloaded" keyword problem with D is just getting worse and worse. 
> 
> I know you are a compiler writer and doing such things as you are makes it
> easier for the compiler, but the continually overloading of keywords with
> different (but similar) meanings in D is bordering on the illegible. What
> you are doing, inadvertently, is making D harder for people to learn,
> understand, and read.

I think so. The 'mixin' keyword is a similar example as well. I think 
for string evaluation it should be 'eval' (as in other languages).


-- serg.
June 29, 2007
Re: Huh, invariant() {...} ?
Ary Manzana wrote:
> [...]
> unittest() {
> }
> 
> Which leaves the possibility to specify something between the parens:
> 
> unittest("List adds correctly an element") {
> }
> 
> and then when an assert fails within a unittest, that message could also 
> be displayed.
> [...]

I proposed something very much like that, and even coded up the 
front-end portion, so that one could construct a library that is a 
worthy competitor to JUnit et al, but nobody was interested (Andrei even 
went so far as to mock it!...but I don't think his xUnit-foo is up to 
snuff ;).

Dave
June 29, 2007
Re: Huh, invariant() {...} ?
If it compiles under 2.001, any way you could post it up here, please? Sounds useful. I've been eying Thomas Khune's UnittestWalker which is powerful, but nothing like a real language extension.

David B. Held Wrote:

> Ary Manzana wrote:
> > [...]
> > unittest() {
> > }
> > 
> > Which leaves the possibility to specify something between the parens:
> > 
> > unittest("List adds correctly an element") {
> > }
> > 
> > and then when an assert fails within a unittest, that message could also 
> > be displayed.
> > [...]
> 
> I proposed something very much like that, and even coded up the 
> front-end portion, so that one could construct a library that is a 
> worthy competitor to JUnit et al, but nobody was interested (Andrei even 
> went so far as to mock it!...but I don't think his xUnit-foo is up to 
> snuff ;).
> 
> Dave
June 30, 2007
Re: Huh, invariant() {...} ?
Robert Fraser wrote:
> If it compiles under 2.001, any way you could post it up here, please? Sounds useful. I've been eying Thomas Khune's UnittestWalker which is powerful, but nothing like a real language extension.

I couldn't finish it because I didn't have the back end to build it 
with.  I suppose I could try hacking GDC, though.

Dave
Next ›   Last »
1 2
Top | Discussion index | About this forum | D home