Re: Scope of variables

2011-06-25 Thread bearophile
Jonathan M Davis: > The situation in D with regards to variable names isn't really any more > complex in D than it is in C++, I don't agree. In D I use many inner functions, so I have to be careful about where a variable is defined, if global, if local, or if local in the outer function. This

Re: Scope of variables

2011-06-25 Thread Jonathan M Davis
On 2011-06-25 05:52, bearophile wrote: > Jonathan M Davis: > >That's why a lot of people typically use a different naming scheme for > >member variables (e.g. prepending them with _ or m_). As long as you're > >smart about naming, it's really not a problem.< > > I too use the leading underscore. T

Re: Scope of variables

2011-06-25 Thread bearophile
Peter Alexander: > This is a solved problem. No need for throwing more and more language > features at it. I agree, from what I am seeing in Haskell it's a mostly solved problem. Bye, bearophile

Re: Scope of variables

2011-06-25 Thread bearophile
Jonathan M Davis: >That's why a lot of people typically use a different naming scheme for member >variables (e.g. prepending them with _ or m_). As long as you're smart about >naming, it's really not a problem.< I too use the leading underscore. The problem with using name tags like the leadin

Re: Scope of variables

2011-06-25 Thread Peter Alexander
On 25/06/11 2:42 AM, Jonathan M Davis wrote: That's why a lot of people typically use a different naming scheme for member variables (e.g. prepending them with _ or m_). As long as you're smart about naming, it's really not a problem. I don't want that to be required though. Yeah. That would

Re: Scope of variables

2011-06-24 Thread Jonathan M Davis
On 2011-06-24 17:39, Adam D. Ruppe wrote: > >void baz(local int k) { > > > >void inner(local int k) {} > > > >} > > This is unneeded. By declaring a local variable, it's > *obviously* local - there's no point in saying local again! > > Now, I've forgotten that I had a vari

Re: Scope of variables

2011-06-24 Thread bearophile
Adam D. Ruppe: > >void baz(local int k) { > >void inner(local int k) {} > >} > > This is unneeded. By declaring a local variable, it's > *obviously* local - there's no point in saying local again! > If D was a bad language that allowed implicit variable definitions, > it might ma

Re: Scope of variables

2011-06-24 Thread Adam D. Ruppe
>void baz(local int k) { >void inner(local int k) {} >} This is unneeded. By declaring a local variable, it's *obviously* local - there's no point in saying local again! Now, I've forgotten that I had a variable declared before, but adding more stuff to the argument list wouldn't

Scope of variables

2011-06-24 Thread bearophile
This post is a follow-up of something I've written almost one year ago, that I have summarized here: http://d.puremagic.com/issues/show_bug.cgi?id=5007 Feel free to ignore this post if you are busy, or if you didn't appreciate the precedent post. In my C/D programs some common troubles (or eve