On Fri, 2021-01-15 at 12:38 -0500, Gary Highberger wrote:
> Hi Everybody,
> 
> Obviously what programming skills I have are other than Oops :-)
> 
> What Oops rule(s) does the following program, autoRun,st, break? Why
> is MyA
> written as #MyA in the error message? Why doesn't the compiler
> understand
> MyA? It's defined in the immediately preceding line.
> 
> Gary Highberger
> 
> cat autoRun.st
> MyA := Array new: 10
> MyA at: 1 put: 'one'
> 3 printNl
> 'hello world' printNl
> 


You need to separate statements by dot, i.e., 

MyA := Array new: 10. "<-- see the dot"
MyA at: 1 put: 'one'. "<-- see the dot"
3 printNl. "<-- see the dot"
'hello world' printNl . "<-- see the dot"

Think of dot as a dot at the end of sentence or
as a ; in most of other languages. 

HTH, Jan



> $ gst autoRun.st
> Object: 10 error: did not understand #MyA
> MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
> SmallInteger(Object)>>doesNotUnderstand: #MyA (SysExcept.st:1448)
> UndefinedObject>>executeStatements (autoRun.st:1)
> 3
> 'hello world'
> $



  • Simple P... Gary Highberger
    • Re:... Jan Vrany
    • Re:... Ludovic
    • Re:... Gary Highberger
      • ... Jan Vrany
      • ... Mark Bratcher
      • ... derek--- via Users mailing list for the GNU Smalltalk environment
        • ... bill-auger
          • ... s...@pandora.be
            • ... bill-auger
          • ... derek--- via Users mailing list for the GNU Smalltalk environment

Reply via email to