Asking for language changes has had a positive effect on my other posts on the SV newsgroup. For example, the ability to assign procedures to arrays.
It’s time for Clarion to have the capability that TS-M2 had in the 90s, which is to chain (method chaining) functions like this:
d = A.Call().Call2().Call3()
For example, today, working with cJson, it would be very important to chain calls to functions to reduce the creation of functions.
That would be really cool.
One thing I’ve done in the past for MS Excel COM from Clarin, was pass a dot-delimited string containing the object names and the respective properties/methods (such as font stuff). Then my Clarion class would parse the string and associate the objects/properties/etc at run-time. These were COM objects, but could easily be Clarion objects too. It really saved a lot of time (except for the time writing it).
Wouldn’t this simply mean, being able to return a class from a function?
Can’t we already?
This code gives a compilation error.
Interesting is that the same IDE supports the containment of functions/methods.
program
map
end
TA class(),type
i long(0)
Call procedure(),*TA
Show procedure()
Test procedure()
END !* TA *
A &TA
B &TA
CODE
A &= new( TA )
B &= A.Call().Call().Call().Call().Call();
B.Show()
TA.Call procedure()
code
self.I = self.I + 5
RETURN self
TA.Test procedure()
code
TA.Show procedure()
code
message( right( self.I, 10 ) )
FWIW, as per the implicit SELF first parameter, you can do:
B &= Call(Call(Call(Call(A.Call()))));
and
B &= Call(Call(Call(Call(Call(A)))));
1 Like