Re: Confessions of an "OO Foreigner"

From: Donald Tees (donald_tees_at_nospam.sympatico.ca)
Date: 12/31/03


Date: Wed, 31 Dec 2003 07:47:18 -0500

LX-i wrote:
> Donald Tees wrote:
>
>> LX-i wrote:
>>
>>> Donald Tees wrote:
>>>
>>>> LX-i wrote:
>>>>
>>>>> I'm with you. Other languages use something like
>>>>> return-value = object.method(parameters)
>>>>>
>>>>> I'm surprised they didn't say
>>>>> INVOKE method-name OF object-name ...
>>>>>
>>>>> This utilizes a very familiar COBOL construct, which is used to
>>>>> uniquely identify data items.
>>>>>
>>>>> Any of you savvier OO guys know of a reason that that wouldn't make
>>>>> more sense?
>>>>>
>>>>>
>>>>
>>>> In reply to that latter, you can do exactly that by using the set
>>>> property method to invoke a procedure.
>>>>
>>>> IE MOVE "action-required" TO INVOCATION-METHOD of object-name.
>>>
>>>
>>>
>>>
>>> Then, would you simply invoke the object? Is that second parameter
>>> optional?
>>>
>>>
>>
>> You have to write a method that interpets "action-required" as a
>> command. The point, though, is that a "MOVE data to property-name of
>> object" is in fact the invocation of a method.
>>
>> Since the syntax you want actually executes code, you can use it for
>> just about any command you want. For example:
>>
>> move "error 26" to display-line of console-one.
>>
>> will open a the console window (if one is not open), display
>> "non-fatal error 26", ask for a character to be typed, then continue,
>> with the following method.
>>
>> method-id. set property display-line.
>> data division.
>> working-storage section.
>> 77 single-character picture x.
>> linkage section.
>> 77 console-line-in picture x(40).
>> procedure division using console-line-in.
>> display "non-fatal " console-line-in.
>> display "type any key to continue".
>> accept single-character.
>> exit method.
>> end method.
>>
>> I am not sure what you are asking. There is only one parameter,
>> referenced to an instance of an object.
>
>
> Well, I've never messed with OO COBOL (though I'd love to, and we've got
> a pending DOD mandate that may force us to, which is fine with me), so
> I'm not really familiar with the syntax. At some point in the program
> with the "move", you'd have to instantiate "console-one" as an instance
> of whatever object has that method, right?
>
>

Yes, exactly. Also at some point you should get rid of it.

Donald