In Ring 1.25 (GitHub) - Better Call command

28 views
Skip to first unread message

Mahmoud Fayed

unread,
Dec 26, 2025, 4:25:30 PM (2 days ago) Dec 26
to The Ring Programming Language
Hello

This is one of the new features provided by Ring 1.25 (under development)

The Call command has been enhanced to allow invoking a function as an object method.

We do this by placing braces after the Call keyword.

Syntax:

Call { Variable([Parameters]) }

Example:

fCheck = func { ? copy("=",50) ? "One day, I will no longer remain just a function." ? "One day, I will live as a method inside an object." ? "That object will have a place in a 3D world." ? "And it will have the x, y, and z attributes." Try ? "X= " + x # Use Attributes ? "Y= " + y ? "Z= " + z ? "The dream has come true." print() # Call Method Catch ? "Not yet!" Done } call fCheck() # Call fCheck as Function new point { x=10 y=20 z=30 call {fCheck()} } # Call fCheck as Method class Point x y z func print ? self

Output:

================================================== One day I will not stay as a function One day I will live as a method inside an object This object will have a place in a 3D world And will have the x,y and z attributes Not yet! ================================================== ================================================== One day I will not stay as a function One day I will live as a method inside an object This object will have a place in a 3D world And will have the x,y and z attributes X= 10 Y= 20 Z= 30 The dream has come true. x: 10 y: 20 z: 30

Greetings,
Mahmoud

Mansour Ayouni

unread,
Dec 26, 2025, 5:04:26 PM (2 days ago) Dec 26
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

This is a wonderful feature!!

Function becomes a reusable coding construct that adapts to any object context...

I asked ClaudeAI to think of the possible applications of this feature:

KEEP INNOVATING,
Mansour

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ring-lang/5cbb658d-3674-4c85-8c96-f43e5913af0an%40googlegroups.com.

Mahmoud Fayed

unread,
Dec 26, 2025, 5:31:01 PM (2 days ago) Dec 26
to The Ring Programming Language
Hello Mansour

>> "I asked ClaudeAI to think of the possible applications of this feature:"

Thank you very much — I enjoyed reading the samples. I think they need very little modification to be fully usable

In practice, instead of using AddMethod(), which add method permanently to the class, the new feature allows us to call temporary methods that can be executed as if they were object methods without becoming part of the class itself. These temporary methods can also be passed as parameters.

This feature was introduced to improve the performance of the Natural Library, but as you mentioned, it opens the door to many additional use cases.

Since we don't pass the object as parameter to the function, this function could be written without knowledge about being an object method, it could use global variables or object attributes based on the usage context.

Greetings,
Mahmoud

Mansour Ayouni

unread,
Dec 26, 2025, 5:42:26 PM (2 days ago) Dec 26
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,
Thank you for your feedback.
All the best,
Mansour

Mahmoud Fayed

unread,
Dec 26, 2025, 5:46:37 PM (2 days ago) Dec 26
to The Ring Programming Language
Hello Mansour

You are welcome :D

Greetings,
Mahmoud

Reply all
Reply to author
Forward
0 new messages