# Method Chaining in future versions of Clarion

**URL:** <https://clarionhub.com/t/method-chaining-in-future-versions-of-clarion/7651>\
**Category:** Feature Requests\
**Tags:** class, language\
**Created:** [November 7, 2024, 11:43pm UTC](https://clarionhub.com/t/method-chaining-in-future-versions-of-clarion/7651 "2024-11-07T23:43:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gustavo\_Saracca](https://clarionhub.com/user_avatar/clarionhub.com/gustavo_saracca/32/5355_2.png) [@Gustavo\_Saracca](https://clarionhub.com/u/Gustavo_Saracca)\
**Post date:** [November 7, 2024, 11:43pm UTC](https://clarionhub.com/t/method-chaining-in-future-versions-of-clarion/7651/1 "2024-11-07T23:43:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [November 8, 2024, 2:21am UTC](https://clarionhub.com/t/method-chaining-in-future-versions-of-clarion/7651/2 "2024-11-08T02:21:36Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![ThaDaSoft](https://clarionhub.com/user_avatar/clarionhub.com/thadasoft/32/3743_2.png) [@ThaDaSoft](https://clarionhub.com/u/ThaDaSoft)\
**Post date:** [November 8, 2024, 2:43pm UTC](https://clarionhub.com/t/method-chaining-in-future-versions-of-clarion/7651/3 "2024-11-08T14:43:42Z")

</div>

Wouldn’t this simply mean, being able to return a class from a function?  
Can’t we already?

---

<div class="post-metadata">

**Author:** ![Gustavo\_Saracca](https://clarionhub.com/user_avatar/clarionhub.com/gustavo_saracca/32/5355_2.png) [@Gustavo\_Saracca](https://clarionhub.com/u/Gustavo_Saracca)\
**Post date:** [November 8, 2024, 3:37pm UTC](https://clarionhub.com/t/method-chaining-in-future-versions-of-clarion/7651/4 "2024-11-08T15:37:17Z")

</div>

This code gives a compilation error.  
Interesting is that the same IDE supports the containment of functions/methods.

```auto
    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 ) )

```

 ![image](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/d/d2b33bc398bcb4fffa8efcfd94a04fecefbd2ef8.png)

---

<div class="post-metadata">

**Author:** ![FedericoNavarro](https://clarionhub.com/letter_avatar_proxy/v4/letter/f/2acd7d/32.png) [@FedericoNavarro](https://clarionhub.com/u/FedericoNavarro)\
**Post date:** [November 8, 2024, 11:03pm UTC](https://clarionhub.com/t/method-chaining-in-future-versions-of-clarion/7651/5 "2024-11-08T23:03:56Z")

</div>

> [@Gustavo\_Saracca](#):
>
> `B &= A.Call().Call().Call().Call().Call();`

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)))));
