O$6.0.3 – Calling a method using a private method as a parameter
Thanks for the reply.
Yesterday I tried using
do method callMe($cinst,$methods.someMethod)
but that doesn’t work. i’ll try using .$findname and see if that does the trick. Ugly syntax and once again requires embedding a literal string in the code (something I avoid like the plague).
On a different note I like $cando()
> On Jun 3, 2017, at 4:54 AM, Vik Shah <Vik@Keys2Solutions.com.au> wrote:
> Hi Lawrence,
> I think what you are after is $cmethod.$name or is it $cmethod().$name. This will eliminate any unknown values being passed around.
> NOTE: passing in $cmethod as a parameter will pass a link to the current executing method before it jumped into the new method.
> So from the calling method you ca do, the following…
> 1. Do method callMe($cmethod().$name)
> 2. Do method callMe($cclass.$methods.$findname(‘someMethod’).$name())
> Another thing you can add to your “callMe” method is a test to see if the name exists… There are again a few ways of doing it…
> 1. if not(isclear($cclass.$methods.$findname(‘someMethod’)))…
> 2. if not($cclass.$methods.[method_name_var].$ident.$cando())
> The $cando() technique is a boolean test to see if a specific notation query can be executed.
> Vik Shah
> AU: +61 411 493 495
> US: +1 (415) 413 4172
> US: +1 (646) 583 2403
>> On 3 Jun 2017, at 05:07, firstname.lastname@example.org wrote:
>> Assuming a single class, I want to a call a method and use an inline call to a private method as a parameter value. I can successfully use a public method as the parameter (e.g. do method callMe($cinst.$someMethod)) but I don’t really want to make $someMethod part of the public API. I want to make the call the equivalent of: do method callMe(do method someMethod). I realize I could pass the private method name as text and then perform a do method [passedValue] inside the receiving method but the calling syntax is less expressive that way, more prone to typos, and doesn’t pass my personal ‘this is clearly a hack’ test. There are certainly times when passing the method name as text is an appropriate solution (delayed execution etc) but in this case not so much.
>> Any thoughts?
>> Manage your list subscriptions at lists.omnis-dev.com
> Manage your list subscriptions at lists.omnis-dev.com
Manage your list subscriptions at lists.omnis-dev.com