Re: "self" keyword

2012-06-15 Thread Rick C. Hodgin
regards, Rick C. Hodgin Original Message From: Václav Zeman Sent: Fri, Jun 15, 2012 08:08 AM To: Oleg Endo CC: Rick C. Hodgin ; David Brown ; Joe Buck ; Ian Lance Taylor ; gcc@gcc.gnu.org Subject: Re: "self" keyword >On 14 June 2012 22:42, Oleg Endo wrote:

Re: "self" keyword

2012-06-15 Thread Václav Zeman
On 14 June 2012 22:42, Oleg Endo wrote: > On Thu, 2012-06-14 at 16:34 -0400, Rick C. Hodgin wrote: >> David, >> >> Well, I probably don't have a NEED for it.  I've gotten along for 25+ >> years without it. :-) >> >> However, what prompted my inquiry is using it would've saved me tracking >> down a

Re: "self" keyword

2012-06-14 Thread Oleg Endo
On Thu, 2012-06-14 at 16:34 -0400, Rick C. Hodgin wrote: > David, > > Well, I probably don't have a NEED for it. I've gotten along for 25+ > years without it. :-) > > However, what prompted my inquiry is using it would've saved me tracking > down a few bugs in recent weeks. Some prior code wa

Re: "self" keyword

2012-06-14 Thread Rick C. Hodgin
Andreas, That would work. But now I'm back to remembering to fix something when I copy / re-use code. I'll admit it's minor. But we have tools to help us for a reason, right? :-) Best regards, Rick C. Hodgin On 06/14/2012 04:38 PM, Andreas Schwab wrote: "Rick C. Hodgin" writes: I can

Re: "self" keyword

2012-06-14 Thread Andreas Schwab
"Rick C. Hodgin" writes: > I can also see a use for generated code where there's a base source code > template in use with an embedded include file reference that changes as > it's generated per pass, such as: > > int step1(int a, int b) > { #define self step1 > #include "\current_task\

Re: "self" keyword

2012-06-14 Thread Rick C. Hodgin
em with writing out the function name in full on those occasions? mvh., David From: gcc-ow...@gcc.gnu.org [gcc-ow...@gcc.gnu.org] on behalf of Ian Lance Taylor [i...@google.com] Sent: Thursday, June 14, 2012 10:19 AM To: Rick C. Hodgin Cc:

Re: "self" keyword

2012-06-14 Thread David Brown
you need recursion - and what is the problem with writing out the function name in full on those occasions? mvh., David From: gcc-ow...@gcc.gnu.org [gcc-ow...@gcc.gnu.org] on behalf of Ian Lance Taylor [i...@google.com] Sent: Thursday, June

RE: "self" keyword

2012-06-14 Thread Joe Buck
@gcc.gnu.org Subject: Re: "self" keyword "Rick C. Hodgin" writes: > I was thinking C and C++. > > int myclass::foo(int a) > { > // recursion > self(a + 1); > } > > Just out of curiosity, why wouldn't it be accepted back into mainline?

Re: "self" keyword

2012-06-14 Thread Ian Lance Taylor
"Rick C. Hodgin" writes: > I was thinking C and C++. > > int myclass::foo(int a) > { > // recursion > self(a + 1); > } > > Just out of curiosity, why wouldn't it be accepted back into mainline? In general these days GCC discourages language extensions. They would have to have a compelli

Re: "self" keyword

2012-06-14 Thread Rick C. Hodgin
David, Oh! Well, it doesn't have to be called self. :-) It could be __self__ or whatever would be fine. I see C99 has __FUNC__ for the current function name used in strings. But, I was thinking more of an actual reference to the current function as a function entity, sort of like a name s

Re: "self" keyword

2012-06-14 Thread David Malcolm
FWIW "self" today is a perfectly good variable name, and practically all C and C++ code that interacts with Python (including the C implementation of Python itself) uses "self" to name variables throughout: many thousands of projects, many millions of lines of code. Having this snatched away as a k

Re: "self" keyword

2012-06-14 Thread Rick C. Hodgin
Ian, I was thinking C and C++. int myclass::foo(int a) { // recursion self(a + 1); } Just out of curiosity, why wouldn't it be accepted back into mainline? Thanks for your help. :-) Best regards, Rick C. Hodgin On 06/14/2012 12:48 PM, Ian Lance Taylor wrote: "Rick C. Hodgin" writes

Re: "self" keyword

2012-06-14 Thread Ian Lance Taylor
"Rick C. Hodgin" writes: > How hard would it be to implement a "self" keyword extension which > references the contextual function name wherein it was referenced? > > int foo(int a) > { > // recursion > self(a + 1); > } > > int food(int a) > { > // recursion > self(a + 1); > } > >