On Mar 23, 2013, at 12:31 PM, "Mohammad Al Houssami (Alumni)" <mha53@mail.aub.edu> wrote:
Hello everyone
I was trying to save my method which has the below piece of code
anythingElseBoolean = false ifFalse: [ doctypeString := reader next: 6 doctypeString asLowercase = 'public' ifTrue: [ AfterDOCTYPEPublicKeywordState value: currentCharacter ]
I get a complain that the AfterDOCTYPEPublicKeywordState is unknown even though I have a method with this name.
AfterDOCTYPEPublicKeywordState is a METHOD???? then, you are missing some points: 1) it does not conforms conventions (it should start with lowercase) 2) you need a self call so, it would be like this: self afterDOCTYPEPublicKeywordState value: currentCharacter. but that is also wrong from a design point of view (anti demeters law). So, you better create a (perhaps private) method who does the assignment. And then you have something like this: self afterDOCTYPEPublicKeywordState: currentCharacter. Esteban
If I move the method call outside outside the ifTrue block to the ifFalse block it doesnât complain.
Is the problem because of nested blocks ? If thatâs the case then what would be a good work around ?
Thanks Mohammad