Thread overview | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 14, 2006 Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
It seems that because inner classes lack an `outer` keyword it is impossible for them to create a new instance for the purpose of COW when operators like opCom are called... sudoku.d(318): outer class Foobar 'this' needed to 'new' nested class BarBar |
July 14, 2006 [OT] Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to S. | S. wrote:
> It seems that because inner classes lack an `outer` keyword it is impossible for
> them to create a new instance for the purpose of COW when operators like opCom
> are called...
>
> sudoku.d(318): outer class Foobar 'this' needed to 'new' nested class BarBar
>
>
sudoku.d as in the game? What does the program do? Is it a generator, a solver, or a player? I ask because I have a solver done and would be interested in comparing them.
|
July 14, 2006 Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to S. | "S." <S._member@pathlink.com> wrote in message news:e98u9d$oqh$1@digitaldaemon.com... > It seems that because inner classes lack an `outer` keyword it is > impossible for > them to create a new instance for the purpose of COW when operators like > opCom > are called... It's irritating, isn't it? The workaround is to make the ctor for the inner class take a reference to its owning outer class, then you can use the syntax Inner dup() { Inner n = outerThis.new Inner(outerThis); return n; } That is, you can 'new' the inner class using the outerThis reference. I suppose another way would be to do some terribly ugly, nonportable hacks to _find_ the outer pointer manually. Maybe if we do that, Walter will see that having an 'outer' reference would be useful. |
July 14, 2006 Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote: > "S." <S._member@pathlink.com> wrote in message news:e98u9d$oqh$1@digitaldaemon.com... >> It seems that because inner classes lack an `outer` keyword it is >> impossible for >> them to create a new instance for the purpose of COW when operators like >> opCom >> are called... > > It's irritating, isn't it? The workaround is to make the ctor for the inner class take a reference to its owning outer class, then you can use the syntax > > Inner dup() > { > Inner n = outerThis.new Inner(outerThis); > return n; > } > > That is, you can 'new' the inner class using the outerThis reference. > > I suppose another way would be to do some terribly ugly, nonportable hacks to _find_ the outer pointer manually. Maybe if we do that, Walter will see that having an 'outer' reference would be useful. Implementation of the inner class always stores the context pointer of the outer class. It could be possible to instantiate yet another inner class by implicitly providing the context pointer of the current outer class to the new inner classes when 'new' is used without a prefix. Again, that's how Java does it. -- Jari-Matti |
July 15, 2006 Re: [OT] Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | On 2006-07-14 13:48:14 -0700, BCS <BCS@pathlink.com> said:
> S. wrote:
>> It seems that because inner classes lack an `outer` keyword it is impossible for
>> them to create a new instance for the purpose of COW when operators like opCom
>> are called...
>>
>> sudoku.d(318): outer class Foobar 'this' needed to 'new' nested class BarBar
>>
>>
>
> sudoku.d as in the game? What does the program do? Is it a generator, a solver, or a player? I ask because I have a solver done and would be interested in comparing them.
Yes, I'm fiddling around with an analytical solver. Mine currently doesn't solve as many as I would like. I only implemented three elimination methods so far.
-S
|
July 15, 2006 Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | On 2006-07-14 14:06:35 -0700, "Jarrett Billingsley" <kb3ctd2@yahoo.com> said:
> "S." <S._member@pathlink.com> wrote in message news:e98u9d$oqh$1@digitaldaemon.com...
>> It seems that because inner classes lack an `outer` keyword it is impossible for
>> them to create a new instance for the purpose of COW when operators like opCom
>> are called...
>
> It's irritating, isn't it? The workaround is to make the ctor for the inner class take a reference to its owning outer class, then you can use the syntax
>
> Inner dup()
> {
> Inner n = outerThis.new Inner(outerThis);
> return n;
> }
>
> That is, you can 'new' the inner class using the outerThis reference.
>
> I suppose another way would be to do some terribly ugly, nonportable hacks to _find_ the outer pointer manually. Maybe if we do that, Walter will see that having an 'outer' reference would be useful.
Yes, I thought of that. But Alas, WTF IS THE POINT OF INNER CLASSES IMPLICITLY HAVING THE THING THEN!?!?!?!?!??!!?
-S
|
July 15, 2006 Re: [OT] Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to S. | On Fri, 14 Jul 2006 17:47:51 -0700, S. <user@pathlink.com> wrote:
> On 2006-07-14 13:48:14 -0700, BCS <BCS@pathlink.com> said:
>
>> S. wrote:
>>> It seems that because inner classes lack an `outer` keyword it is
>>> impossible for
>>> them to create a new instance for the purpose of COW when operators
>>> like opCom
>>> are called...
>>> sudoku.d(318): outer class Foobar 'this' needed to 'new' nested class
>>> BarBar
>>>
>> sudoku.d as in the game? What does the program do? Is it a generator,
>> a solver, or a player? I ask because I have a solver done and would be
>> interested in comparing them.
>
> Yes, I'm fiddling around with an analytical solver. Mine currently doesn't solve as many as I would like. I only implemented three elimination methods so far.
I wrote a sudoku solver too. It expects the puzzle in a CSV file, example attached.
As far as I know it will solve anything which is 'logically solvable' .. in other words as long as there is always at least one definate next step with no 2+ choices and guessing involved.
Regan
|
July 16, 2006 Re: [OT] Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | Regan Heath wrote:
> On Fri, 14 Jul 2006 17:47:51 -0700, S. <user@pathlink.com> wrote:
>
>> On 2006-07-14 13:48:14 -0700, BCS <BCS@pathlink.com> said:
>>
>>> S. wrote:
>>>
>>>> It seems that because inner classes lack an `outer` keyword it is impossible for
>>>> them to create a new instance for the purpose of COW when operators like opCom
>>>> are called...
>>>> sudoku.d(318): outer class Foobar 'this' needed to 'new' nested class BarBar
>>>>
>>> sudoku.d as in the game? What does the program do? Is it a generator, a solver, or a player? I ask because I have a solver done and would be interested in comparing them.
>>
>>
>> Yes, I'm fiddling around with an analytical solver. Mine currently doesn't solve as many as I would like. I only implemented three elimination methods so far.
>
> I wrote a sudoku solver too. It expects the puzzle in a CSV file, example attached.
>
> As far as I know it will solve anything which is 'logically solvable' .. in other words as long as there is always at least one definate next step with no 2+ choices and guessing involved.
>
> Regan
Mine goes the other direction, only set cells that have only one choice left, when you run out of those, store the state and guess. It uses a stack like system for the states. It was/is solving puzzles in about 2.75 ms. I think it will solve any puzzle that can be solved, and with a little modification, will check if more than one solution exists.
|
July 16, 2006 Re: [OT] Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | On 2006-07-15 02:52:42 -0700, "Regan Heath" <regan@netwin.co.nz> said:
> ------------IvETWbTDu3bk1hw3mOmW4b
> Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15
> Content-Transfer-Encoding: 8bit
>
> On Fri, 14 Jul 2006 17:47:51 -0700, S. <user@pathlink.com> wrote:
>> On 2006-07-14 13:48:14 -0700, BCS <BCS@pathlink.com> said:
>>
>>> S. wrote:
>>>> It seems that because inner classes lack an `outer` keyword it is impossible for
>>>> them to create a new instance for the purpose of COW when operators like opCom
>>>> are called...
>>>> sudoku.d(318): outer class Foobar 'this' needed to 'new' nested class BarBar
>>>>
>>> sudoku.d as in the game? What does the program do? Is it a generator, a solver, or a player? I ask because I have a solver done and would be interested in comparing them.
>>
>> Yes, I'm fiddling around with an analytical solver. Mine currently doesn't solve as many as I would like. I only implemented three elimination methods so far.
>
> I wrote a sudoku solver too. It expects the puzzle in a CSV file, example attached.
>
> As far as I know it will solve anything which is 'logically solvable' .. in other words as long as there is always at least one definate next step with no 2+ choices and guessing involved.
I peaked at your code. From a brief look it doesn't seem that it handles several more advanced analytical techniques. For example if all the posibilities for a number within a box reside on the same row or column, then it is required that the other boxes that contain that column not have it within the column. Etc, There are some really advanced ones like X-Wing etc. I don't fully understand those techniques yet though.
I'll post my current code here monday or so. I broke it while implementing constraint propagation for fun.
|
July 16, 2006 Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to S. | S. wrote: > On 2006-07-14 14:06:35 -0700, "Jarrett Billingsley" <kb3ctd2@yahoo.com> said: > >> "S." <S._member@pathlink.com> wrote in message news:e98u9d$oqh$1@digitaldaemon.com... >>> It seems that because inner classes lack an `outer` keyword it is impossible for >>> them to create a new instance for the purpose of COW when operators like opCom >>> are called... >> >> It's irritating, isn't it? The workaround is to make the ctor for the inner class take a reference to its owning outer class, then you can use the syntax >> >> Inner dup() >> { >> Inner n = outerThis.new Inner(outerThis); >> return n; >> } >> >> That is, you can 'new' the inner class using the outerThis reference. >> >> I suppose another way would be to do some terribly ugly, nonportable hacks to _find_ the outer pointer manually. Maybe if we do that, Walter will see that having an 'outer' reference would be useful. > > Yes, I thought of that. But Alas, WTF IS THE POINT OF INNER CLASSES IMPLICITLY HAVING THE THING THEN!?!?!?!?!??!!? > > -S > I believe he mentioned that as just a "workaround", a temporary solution, not a final one! -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D |
Copyright © 1999-2021 by the D Language Foundation