Thread overview | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
March 27, 2003 with/struct | ||||
---|---|---|---|---|
| ||||
Hi, can someone please explain to me the reasoning behind not allowing with () for structs? ------------------------- Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-25 |
March 27, 2003 Re: with/struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | "Carlos Santander B." <carlos8294@msn.com> wrote in message news:b5vi3m$25un$1@digitaldaemon.com... > Hi, can someone please explain to me the reasoning behind not allowing with > () for structs? Oversight? :-) |
March 11, 2004 Re: with/struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | In article <b5vmge$2a17$3@digitaldaemon.com>, Walter says... > > >"Carlos Santander B." <carlos8294@msn.com> wrote in message news:b5vi3m$25un$1@digitaldaemon.com... >> Hi, can someone please explain to me the reasoning behind not allowing >with >> () for structs? > >Oversight? :-) > > Walter, what has happened with this? Still doesn't work... ------------------- Carlos Santander B. |
March 11, 2004 Re: with/struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | On Thu, 11 Mar 2004 16:54:50 +0000, Carlos Santander B. wrote:
> In article <b5vmge$2a17$3@digitaldaemon.com>, Walter says...
>>
>>
>>"Carlos Santander B." <carlos8294@msn.com> wrote in message news:b5vi3m$25un$1@digitaldaemon.com...
>>> Hi, can someone please explain to me the reasoning behind not allowing
>>with
>>> () for structs?
>>
>>Oversight? :-)
>>
>>
>
> Walter, what has happened with this? Still doesn't work...
>
> -------------------
> Carlos Santander B.
If you ask me 'with' is up there
with 'goto' and 'break' and 'continue'.
'with' is an invitation to coders to expose
details that should be hidden somewhere else :p
Ant
|
March 11, 2004 Re: with/struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | I don't think i can follow. I come from Delphi where i came to like it. It is mostly a notational shortcut.
-eye
Ant schrieb:
> If you ask me 'with' is up there
> with 'goto' and 'break' and 'continue'.
>
> 'with' is an invitation to coders to expose
> details that should be hidden somewhere else :p
>
> Ant
>
|
March 11, 2004 Re: with/struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Ant wrote: > On Thu, 11 Mar 2004 16:54:50 +0000, Carlos Santander B. wrote: > > >>In article <b5vmge$2a17$3@digitaldaemon.com>, Walter says... >> >>> >>>"Carlos Santander B." <carlos8294@msn.com> wrote in message >>>news:b5vi3m$25un$1@digitaldaemon.com... >>> >>>>Hi, can someone please explain to me the reasoning behind not allowing >>> >>>with >>> >>>>() for structs? >>> >>>Oversight? :-) >>> >>> >> >>Walter, what has happened with this? Still doesn't work... >> >>------------------- >>Carlos Santander B. > > > If you ask me 'with' is up there > with 'goto' and 'break' and 'continue'. > > 'with' is an invitation to coders to expose > details that should be hidden somewhere else :p > > Ant > I like "with". I go out of my way to use it. I'd use it for structs, too, if the compiler allowed it. I don't like "goto" (I prefer my spaghetti on a dinner plate), either. I have to use "break" on all of my switch constructs because I rarely fall-through. I don't think I've ever used "continue". What's it for? :) -- Justin http://jcc_7.tripod.com/d/ |
March 11, 2004 Re: with/struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | On Thu, 11 Mar 2004 17:47:48 -0600, J C Calvarese wrote: > Ant wrote: >> >> If you ask me 'with' is up there >> with 'goto' and 'break' and 'continue'. >> >> 'with' is an invitation to coders to expose >> details that should be hidden somewhere else :p >> >> Ant >> > > I like "with". I go out of my way to use it. I'd use it for structs, too, if the compiler allowed it. > > I don't like "goto" (I prefer my spaghetti on a dinner plate), either. > > I have to use "break" on all of my switch constructs because I rarely fall-through. That 'break' is different. > > I don't think I've ever used "continue". What's it for? :) As I remember on looks skips the rest of the current iteraction. Ant |
March 12, 2004 Re: with/struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | On Fri, 12 Mar 2004 00:33:49 +0100, Ilya Minkov wrote:
> I don't think i can follow. I come from Delphi where i came to like
> it [with].
> It is mostly a notational shortcut.
>
> -eye
nobody is perfect ;)
Ant
|
March 12, 2004 Re: with/struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Ant wrote:
> If you ask me 'with' is up there
> with 'goto' and 'break' and 'continue'.
>
> 'with' is an invitation to coders to expose
> details that should be hidden somewhere else :p
There's a case to be made that the with() construct reduces errors as well, as the program isn't typing the same identifier over and over again. It also makes code easier to read.
with() can certainly be misused, but so can switch:
switch (x) {
while (x) {
printf("%i\n", x);
x++;
continue;
case 0: x = 1337; continue;
case 1: x = -1; continue;
}
}
-- andy
|
March 12, 2004 Re: with/struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | On Thu, 11 Mar 2004 17:29:54 -0800, Andy Friesen wrote: > Ant wrote: >> If you ask me 'with' is up there >> with 'goto' and 'break' and 'continue'. >> >> 'with' is an invitation to coders to expose >> details that should be hidden somewhere else :p > > There's a case to be made that the with() construct reduces errors as well, as the program isn't typing the same identifier over and over again. but that's my point, if your are typing the same identifier over and over you should review something. (you have to forgive me all these rants come from years of working with code of inferior quality and I can assure you: no 'break', 'goto', 'continue' or 'with' are necessary to produce bad code:( ) > It also makes code easier to read. > > with() can certainly be misused, but so can switch: > > switch (x) { > while (x) { > printf("%i\n", x); > > x++; > continue; > > case 0: x = 1337; continue; > case 1: x = -1; continue; > } > } > > -- andy Someone showed before that you could have a statment inside a switch but outside a case! (did you compile that?) is that common to other languages? I don't remember seeing it and certanly I don't intend to use it. Ant |
Copyright © 1999-2021 by the D Language Foundation