June 30, 2004
Walter wrote:

> "dennis luehring" <dl.soluz@gmx.net> wrote in message
> news:cbs1tq$21qe$1@digitaldaemon.com...
> 
>>and a some embedded-question:
>>
>>will D ever compileable on 16bit machines?
> No. Sorry.

maybe in the next project

>>is D fast enough (compared with paradigm-c)?
> It's as fast as C is. As proof, you can write your code in C-style in D, and
> it'll compile into essentially the same code.

thx (i've read Dan Williams "Various D language matters" post...)
June 30, 2004
> which then only makes 1 copy, the one explicitly shown above.

ok away from this - do we need a copy, is it right to use a copy, should everyone must use a copy stuff talk... (its between semtanic and best-use-case or something i think)

a question about an language currently in the design phase:
is it ok for D (like for many other lanugages) to help programmers getting in trouble with such a little piece of code... (how can i prevent me from searching for such bugs in code that was written by unexperienced people years ago... - always use x bugpattern find tools??? it can't be)

from Sean:
"it's not the job of a programming language to protect the programmer from himself..."

but

"it could be the job of an (new) programming language to protect the programmer from other programmers (or stupid bugs they made) and make it more easy to find the 'bugs'"

(btw: where can i download the "programming language jobs reference")

can't the D compiler get an option like:
--force-in-arguments-as-constant
or something

and this const& thing was only an example: there are much more of such bugpatterns out there...

designbycontract/unittest stuff is integrated in D - what speaks agains the above...

ciao dennis

June 30, 2004
> in D it could be the best solution to declare (as compiler default) all
> paramter copies as "const" so a typo would
> result in an compiler error (l-value specifies const object) or
> something (like pascal does?)

Nope, not Pascal. Pascal has:

procedure x(const int: integer); //constant
procedure y(int: integer); //by value
procedure z(var int: integer); //by ref

At least, the Borland dialect does...

infact, the Borland dialect has 'in' and 'out' now too, iirc, through COM.

Matt


June 30, 2004
On Wed, 30 Jun 2004 10:26:21 +0200, dennis luehring <dl.soluz@gmx.net> wrote:

>> which then only makes 1 copy, the one explicitly shown above.
>
> ok away from this - do we need a copy, is it right to use a copy, should everyone must use a copy stuff talk... (its between semtanic and best-use-case or something i think)

Well.. C/C++ passes copies, that is why people pass pointers, this leaves you de-referencing a pointer in the function, which is why pass by reference was invented.

Obviously my view is that 'in' the default parameter passing method should not be a copy..however often it is more efficient to pass a copy.. given that the variable will not be modified the compiler *can* optimise by copying if it wants.

> a question about an language currently in the design phase:
> is it ok for D (like for many other lanugages) to help programmers getting in trouble with such a little piece of code... (how can i prevent me from searching for such bugs in code that was written by unexperienced people years ago... - always use x bugpattern find tools??? it can't be)

I believe my idea for changes to 'in' will solve this bug, and perhaps others.

Walters view of C/C++'s const is that is does not solve any bugs, I believe my idea is different enough to C/C++'s const that it does solve bugs, and at no real cost to the programmer.

> from Sean:
> "it's not the job of a programming language to protect the programmer from himself..."
>
> but
>
> "it could be the job of an (new) programming language to protect the programmer from other programmers (or stupid bugs they made) and make it more easy to find the 'bugs'"
>
> (btw: where can i download the "programming language jobs reference")
>
> can't the D compiler get an option like:
> --force-in-arguments-as-constant
> or something

IMO this is a seperate stage to compiling. You want a compiler to compile the instructions and make a program. Next stage is, double checking you're not doing something silly, a lint-like program is what you use for this stage.

Walter has mentioned that a lint-like program could be written using the DMD front end.

I think seperating these tasks is the way to go.

This creates consistency in the compiler and all implementations of the compiler.

> and this const& thing was only an example: there are much more of such bugpatterns out there...

Indeed. Some are very hard to identify as such, some are valid in certain cases and it is hard for a program to identify these cases without the sort of context a human brain can use to make the decision.

> designbycontract/unittest stuff is integrated in D - what speaks agains the above...

It goes a long way to helping the programmer catch thier own mistakes. I like it.

Regan.

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
1 2
Next ›   Last »