D - [VOTE:] Should the cast operator be mandatory?
- Matthew (1/1) Mar 17 2004 Matthew: Yes
- J Anderson (5/6) Mar 17 2004 Cast on everything be mandatory? Details, sorry I missed the discussion...
- Matthew (7/13) Mar 17 2004 Anytime a cast is used, it should be via the cast operator, rather than ...
- Ben Hinkle (14/29) Mar 17 2004 I tried scanning the subject lines for cast and could only find the one
- J C Calvarese (7/41) Mar 17 2004 It's another case of thread drift. I can't blame anyone else because I'm...
- larry cowan (7/22) Mar 17 2004 As I understand it, the vote is whether, having the "cast" keyword, it s...
- Andy Friesen (5/6) Mar 17 2004 cast(X)x good
- Juan C (4/10) Mar 17 2004 Well, yes, but -- "Oh no! It'll make porting from C more difficult!"
- Matthew (4/18) Mar 17 2004 In this case that "more difficult" is a good thing!
- Vathix (5/9) Mar 17 2004 How about making it a deprecated feature, so you have to pass -d to the
- Matthew (5/14) Mar 17 2004 I could live with that, but I reckon it'll just smell like a warning by
- =?ISO-8859-1?Q?Sigbj=F8rn_Lund_Olsen?= (11/13) Mar 19 2004 Except, of course, unlike C compilers where you have to explicitly tell
- C. Sauls (2/3) Mar 17 2004
- Andrew Edwards (4/5) Mar 17 2004 Andrew: Yes!
- Carlos Santander B. (3/3) Mar 17 2004 Sí, yes, oui. Sorry, can't remember more of those :D.
- J C Calvarese (5/7) Mar 17 2004 Yes. C-style casts hurt my eyes.
- C (2/3) Mar 17 2004
- Derek Parnell (8/8) Mar 17 2004 My vote: Yes
- Phill (4/5) Mar 18 2004 Yep (so im aware of what im actually doing)
- =?ISO-8859-1?Q?Sigbj=F8rn_Lund_Olsen?= (4/7) Mar 19 2004 Yes.
- Kris (3/4) Mar 19 2004 Another "yes"
- Burton Radons (3/3) Mar 22 2004 The cast operator is broken; it should be "cast (a, b)", so no. Having
- Ant (8/11) Mar 23 2004 We discussed alternative cast sintax, the one that looks better is
- Burton Radons (7/20) Mar 23 2004 I wasn't. But I don't like fake methods and properties; they get into a...
- Andy Friesen (4/7) Mar 23 2004 I like it. It looks like a cast and not a function call. It's also
Matthew wrote:Matthew: YesCast on everything be mandatory? Details, sorry I missed the discussion on this. -- -Anderson: http://badmama.com.au/~anderson/
Mar 17 2004
"J Anderson" <REMOVEanderson badmama.com.au> wrote in message news:c39hva$1m1u$1 digitaldaemon.com...Matthew wrote: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.Matthew: YesCast on everything be mandatory?Details, sorry I missed the discussion on this.Haven't time to summarise, but there're lots of recent posts.
Mar 17 2004
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...That'sMatthew wrote: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.Matthew: YesCast on everything be mandatory?another debate entirely.Details, sorry I missed the discussion on this.Haven't time to summarise, but there're lots of recent posts.
Mar 17 2004
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/25705If 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...Justin http://jcc_7.tripod.com/d/"J Anderson" <REMOVEanderson badmama.com.au> wrote in message news:c39hva$1m1u$1 digitaldaemon.com...That'sMatthew wrote: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.Matthew: YesCast on everything be mandatory?another debate entirely.Details, sorry I missed the discussion on this.Haven't time to summarise, but there're lots of recent posts.
Mar 17 2004
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: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.Matthew: YesCast on everything be mandatory?Details, sorry I missed the discussion on this.Haven't time to summarise, but there're lots of recent posts.
Mar 17 2004
Matthew wrote:Matthew: Yescast(X)x good (X)x not. Yes. -- andy
Mar 17 2004
Well, yes, but -- "Oh no! It'll make porting from C more difficult!" It seems to me that this is another case where Walter would prefer to leave in a flaw from C -- rather than making D the best language it can be. In article <c39n7m$1uqk$1 digitaldaemon.com>, Andy Friesen says...Matthew wrote:Matthew: Yescast(X)x good (X)x not. Yes. -- andy
Mar 17 2004
"Juan C" <Juan_member pathlink.com> wrote in message news:c39vkk$2fof$1 digitaldaemon.com...Well, yes, but -- "Oh no! It'll make porting from C more difficult!"In this case that "more difficult" is a good thing!It seems to me that this is another case where Walter would prefer toleave in aflaw from C -- rather than making D the best language it can be. In article <c39n7m$1uqk$1 digitaldaemon.com>, Andy Friesen says...Matthew wrote:Matthew: Yescast(X)x good (X)x not. Yes. -- andy
Mar 17 2004
Juan C wrote:Well, yes, but -- "Oh no! It'll make porting from C more difficult!" It seems to me that this is another case where Walter would prefer to leave in a flaw from C -- rather than making D the best language it can be.How about making it a deprecated feature, so you have to pass -d to the command line for it to compile? -- Christopher E. Miller
Mar 17 2004
I could live with that, but I reckon it'll just smell like a warning by another name to big-W "Vathix" <vathix dprogramming.com> wrote in message news:c3a43k$2ocm$1 digitaldaemon.com...Juan C wrote:leave in aWell, yes, but -- "Oh no! It'll make porting from C more difficult!" It seems to me that this is another case where Walter would prefer toflaw from C -- rather than making D the best language it can be.How about making it a deprecated feature, so you have to pass -d to the command line for it to compile? -- Christopher E. Miller
Mar 17 2004
Matthew wrote:I could live with that, but I reckon it'll just smell like a warning by another name to big-WExcept, 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
Mar 19 2004
On Wed, 17 Mar 2004 12:18:00 -0000, Matthew <matthew stlsoft.org> wrote:Matthew: YesAndrew: Yes! Vathix's deprecated (-d) suggestion may warrant a second look! However, I don't think it necessary.
Mar 17 2004
Sí, yes, oui. Sorry, can't remember more of those :D. ----------------------- Carlos Santander Bernal
Mar 17 2004
Matthew wrote:Matthew: YesYes. C-style casts hurt my eyes. -- Justin http://jcc_7.tripod.com/d/
Mar 17 2004
Yes On Wed, 17 Mar 2004 12:18:00 -0000, Matthew <matthew stlsoft.org> wrote:=Matthew: Yes
Mar 17 2004
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
Mar 17 2004
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
Mar 18 2004
Matthew wrote:Matthew: YesYes. Cheers, Sigbjørn Lund Olsen
Mar 19 2004
Another "yes" "Matthew" <matthew stlsoft.org> wrote in message news:c39fo1$1iq4$3 digitaldaemon.com...Matthew: Yes
Mar 19 2004
The cast operator is broken; it should be "cast (a, b)", so no. Having a non-broken alternative that at least has the benefit of being historic is better than one which makes code look like crap.
Mar 22 2004
In article <c3oo6k$2v44$1 digitaldaemon.com>, Burton Radons says...The cast operator is broken; it should be "cast (a, b)", so no. Having a non-broken alternative that at least has the benefit of being historic is better than one which makes code look like crap.We discussed alternative cast sintax, the one that looks better is a.castTo(B) however seems to have been rejected by Walter. (were you here at that time?) the problem with cast(a,b) is that it's not explicit whit is the type. Ant
Mar 23 2004
Ant wrote:In article <c3oo6k$2v44$1 digitaldaemon.com>, Burton Radons says...I wasn't. But I don't like fake methods and properties; they get into a lot of unintentional conflicts and method conflicts are much messier than function conflicts.The cast operator is broken; it should be "cast (a, b)", so no. Having a non-broken alternative that at least has the benefit of being historic is better than one which makes code look like crap.We discussed alternative cast sintax, the one that looks better is a.castTo(B) however seems to have been rejected by Walter. (were you here at that time?)the problem with cast(a,b) is that it's not explicit whit is the type.Eh? You don't have any functions or methods that take more than one argument? Just have an explicit error in the compiler; a couple doses of that and one shouldn't make the mistake ever again.
Mar 23 2004
Burton Radons wrote:The cast operator is broken; it should be "cast (a, b)", so no. Having a non-broken alternative that at least has the benefit of being historic is better than one which makes code look like crap.I like it. It looks like a cast and not a function call. It's also easy for a compiler to parse and for a programmer to recognize. -- andy
Mar 23 2004