March 17, 2004 Re: [VOTE:] Should the cast operator be mandatory? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Sí, yes, oui. Sorry, can't remember more of those :D. ----------------------- Carlos Santander Bernal |
March 17, 2004 Re: [VOTE:] Should the cast operator be mandatory? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | I tried scanning the subject lines for cast and could only find the one about implicit narrow casting. Is there a subject line for the thread about C-style casts? If the primary reason to remove C-style casts is to make parsing easier then I'd say go for it because parsing code is a big part of writing quality tools and editors. For users the mental jump from (foo)bar to cast(foo)bar is pretty easy compared to other semantics changes D has from C (hint, arrays). -Ben "Matthew" <matthew@stlsoft.org> wrote in message news:c39k1e$1pnp$1@digitaldaemon.com... > > "J Anderson" <REMOVEanderson@badmama.com.au> wrote in message news:c39hva$1m1u$1@digitaldaemon.com... > > Matthew wrote: > > > > >Matthew: Yes > > > > > > > Cast on everything be mandatory? > > Anytime a cast is used, it should be via the cast operator, rather than a C-style cast. > > It doesn't mean that all implicit conversions should be given a cast. That's > another debate entirely. > > > Details, sorry I missed the discussion > > on this. > > Haven't time to summarise, but there're lots of recent posts. |
March 17, 2004 Re: [VOTE:] Should the cast operator be mandatory? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | In article <c3abvi$527$1@digitaldaemon.com>, Ben Hinkle says... > >I tried scanning the subject lines for cast and could only find the one >about >implicit narrow casting. >Is there a subject line for the thread about C-style casts? It's another case of thread drift. I can't blame anyone else because I'm part of the problem. ;) Subject: Re: [BUG] dmd does not implement LR analysis URL: http://www.digitalmars.com/drn-bin/wwwnews?D/25705 > >If the primary reason to remove C-style casts is to make parsing easier then I'd say go for it because parsing code is a big part of writing quality tools and editors. > >For users the mental jump from (foo)bar to cast(foo)bar is pretty >easy compared to other semantics changes D has from C (hint, >arrays). > >-Ben > >"Matthew" <matthew@stlsoft.org> wrote in message news:c39k1e$1pnp$1@digitaldaemon.com... >> >> "J Anderson" <REMOVEanderson@badmama.com.au> wrote in message news:c39hva$1m1u$1@digitaldaemon.com... >> > Matthew wrote: >> > >> > >Matthew: Yes >> > > >> > >> > Cast on everything be mandatory? >> >> Anytime a cast is used, it should be via the cast operator, rather than a C-style cast. >> >> It doesn't mean that all implicit conversions should be given a cast. >That's >> another debate entirely. >> >> > Details, sorry I missed the discussion >> > on this. >> >> Haven't time to summarise, but there're lots of recent posts. > > Justin http://jcc_7.tripod.com/d/ |
March 17, 2004 Re: [VOTE:] Should the cast operator be mandatory? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | As I understand it, the vote is whether, having the "cast" keyword, it should be required rather than optional for all explicit casts. Sorry, I thought it was required, at least in some cases. My vote is YES, always (or forget the word as a keyword entirely). I prefer D's form to C's form - it points out more obviously where something is being type-changed from your expectation, and can be searched for more easily. In article <c39k1e$1pnp$1@digitaldaemon.com>, Matthew says... > > >"J Anderson" <REMOVEanderson@badmama.com.au> wrote in message news:c39hva$1m1u$1@digitaldaemon.com... >> Matthew wrote: >> >> >Matthew: Yes >> > >> >> Cast on everything be mandatory? > >Anytime a cast is used, it should be via the cast operator, rather than a C-style cast. > >It doesn't mean that all implicit conversions should be given a cast. That's another debate entirely. > >> Details, sorry I missed the discussion >> on this. > >Haven't time to summarise, but there're lots of recent posts. > > |
March 17, 2004 Re: [VOTE:] Should the cast operator be mandatory? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote: > Matthew: Yes > Yes. C-style casts hurt my eyes. -- Justin http://jcc_7.tripod.com/d/ |
March 18, 2004 Re: [VOTE:] Should the cast operator be mandatory? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Yes
On Wed, 17 Mar 2004 12:18:00 -0000, Matthew <matthew@stlsoft.org> wrote:
> Matthew: Yes
>
>
|
March 18, 2004 Re: [VOTE:] Should the cast operator be mandatory? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | My vote: Yes
Reasons:
(a) An explicit keyword makes the coder's intentions more obvious to the reader.
(b) An explicit keyword makes the code more 'grepable'.
(c) Makes Walter's job easier (less parsing bugs etc...)
--
Derek
|
March 18, 2004 Re: [VOTE:] Should the cast operator be mandatory? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Yep (so im aware of what im actually doing) Phill. "Matthew" <matthew@stlsoft.org> wrote in message news:c39fo1$1iq4$3@digitaldaemon.com... > Matthew: Yes > > |
March 19, 2004 Re: [VOTE:] Should the cast operator be mandatory? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote:
> Matthew: Yes
>
>
Yes.
Cheers,
Sigbjørn Lund Olsen
|
March 19, 2004 Re: [VOTE:] Should the cast operator be mandatory? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote:
> I could live with that, but I reckon it'll just smell like a warning by
> another name to big-W
Except, of course, unlike C compilers where you have to explicitly tell it to enforce stricter behaviour through -ansi, -warnings-as-errors (or suchnot), in this case the code would *not* compile unless you explicitly told it to ignore something.
Not that I support the idea of deprecating it. There's no reason to leave twaddle with a language to make it easier to do bad things conveniently, when part of the point of the language has been to *break* compatability to correct flaws, where C++ did not.
Cheers,
Sigbjørn Lund Olsen
|
Copyright © 1999-2021 by the D Language Foundation