OOP: a class using a class that is descended from it?

2017-08-03 Thread hw
Hi, suppose I have a class FOO and a class BAR. The parent of BAR is FOO. I would like FOO to /use/ BAR because BAR has some methods needed by FOO. BAR is /decended/ from FOO because FOO has many methods needed by BAR. Is this possible, or does it lead to some endless recursion when

Re: OOP: a class using a class that is descended from it?

2017-08-03 Thread Andrew Solomon
My instinct before trying this would be to move the methods which FOO needs back into FOO (removing them from BAR). Is there a reason this won't work for you? On Thu, Aug 3, 2017 at 7:44 PM, hw wrote: > > Hi, > > suppose I have a class FOO and a class BAR. The parent of BAR is

Re: perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i: $i\n";'

2017-08-03 Thread hw
David Mertens wrote: On Thu, Jul 6, 2017 at 11:05 PM, > wrote: Perl is highly unusual in that the operator, not the operand, dictates the context. Good point - and one that I hadn't got around to noticing.

Re: OOP: a class using a class that is descended from it?

2017-08-03 Thread Andrew Solomon
On Thu, Aug 3, 2017 at 8:48 PM, hw wrote: > Andrew Solomon wrote: > >> My instinct before trying this would be to move the methods which FOO >> needs back into FOO (removing them from BAR). >> >> Is there a reason this won't work for you? >> > > Hmm. I haven´t thought of that

Re: OOP: a class using a class that is descended from it?

2017-08-03 Thread hw
Andrew Solomon wrote: My instinct before trying this would be to move the methods which FOO needs back into FOO (removing them from BAR). Is there a reason this won't work for you? Hmm. I haven´t thought of that because they don´t belong into FOO. They also won´t work in FOO because both

Re: perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i: $i\n";'

2017-08-03 Thread Paul Johnson
On Thu, Aug 03, 2017 at 09:27:42PM +0200, hw wrote: > > It is nonsense to logically negate a string, and it is nonsense to convert > undefined values into 'false'. Either are neither false, nor true. > > For undefined values, there is no way of deciding whether they are true or > false >

Re: OOP: a class using a class that is descended from it?

2017-08-03 Thread Shawn H Corey
On Thu, 3 Aug 2017 20:44:45 +0200 hw wrote: > > Hi, > > suppose I have a class FOO and a class BAR. The parent of BAR is FOO. > > I would like FOO to /use/ BAR because BAR has some methods needed by > FOO. BAR is /decended/ from FOO because FOO has many methods needed > by

Re: perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i: $i\n";'

2017-08-03 Thread Chas. Owens
On Thu, Aug 3, 2017 at 3:29 PM hw wrote: > David Mertens wrote: > It is nonsense to logically negate a string, and it is nonsense to convert > undefined values into 'false'. Negating strings is a well defined operation in Perl 5. The following values in Perl 5 are false: undef,