In Ring 1.25 (GitHub) - Newline Callbacks Inside Braces

86 views
Skip to first unread message

Mahmoud Fayed

unread,
Jan 4, 2026, 12:52:03 AM (8 days ago) Jan 4
to The Ring Programming Language
Hello

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

BraceNewLine() is a callback that Ring automatically triggers whenever a logical newline is encountered when we access an object using braces. If a line contains expressions, the method is called after those expressions are processed. If the block contains one or more empty lines, Ring treats all consecutive empty lines as a single break, so is invoked only once no matter how many blank lines appear.

Example:

new SumRows { 10 20 30 # 60 10 # 10 400 100 # 500 30 40 # 70 } class SumRows lSum = False nSum = 0 nLastRow = 0 func braceExprEval value lSum = True nSum += value func braceNewLine if lSum ? nSum nSum=0 lSum=False ok

Output:

60 10 500 70

Greetings,
Mahmoud

Youssef Saeed

unread,
Jan 4, 2026, 6:24:12 AM (7 days ago) Jan 4
to The Ring Programming Language
Hello Mahmoud,

Thank you for sharing this Ring 1.25 feature–BraceNewLine() inside braces is a really nice addition and will definitely make building line-oriented DSLs and data blocks much cleaner, especially when combined with the existing brace-callback model.

Best regards,  
Youssef

The Future of Programming

unread,
Jan 4, 2026, 6:42:52 AM (7 days ago) Jan 4
to The Ring Programming Language
Hello Youssef

You are welcome :D

Greetings, 
Mahmoud

--

---
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/77cf5136-98c4-43be-b77a-2480509dc494n%40googlegroups.com.

Mansour Ayouni

unread,
Jan 4, 2026, 8:23:18 AM (7 days ago) Jan 4
to The Future of Programming, The Ring Programming Language
Nice feature!
Thank you Mahmoud.
Best,
Mansour

The Future of Programming

unread,
Jan 4, 2026, 9:49:50 AM (7 days ago) Jan 4
to The Ring Programming Language
Hello Mansour

You are welcome :D

Greetings, 
Mahmoud

Bert Mariani

unread,
Jan 4, 2026, 10:54:35 AM (7 days ago) Jan 4
to The Ring Programming Language
Hello Mahmoud

I don't quite understand your example

Can you provide another example of calling this function.
Why you would use it and when  using imperative instructions

Thanks
Bert Mariani

Mahmoud Fayed

unread,
Jan 4, 2026, 11:37:51 AM (7 days ago) Jan 4
to The Ring Programming Language
Hello Bert

>> "Why you would use it and when  using imperative instructions"

One of the goals of the Ring language is to enable the definition of domain specific languages through innovative features built on top of Ring classes.
These features, such as BraceStart(), BraceEnd(), BraceExprEval(), and BraceError(), enable a parsing technique based on using braces to access an object and trigger event‑driven method calls.

However, this parsing approach relies on examining the current token and immediately deciding what to do next, such as executing a command, adding the token to a buffer, or updating a counter.

This creates a problem when trying to implement commands that share the same initial tokens, such as:
Command 1: (I want window) 
Command 2: (I want window now)

If the parser decides to execute (I want window) immediately after reading the word "window", then it becomes impossible to define a longer command like (I want window now). On the other hand, if the parser delays execution to allow (I want window now), then the shorter command (I want window) can no longer be defined or executed.

The classical solution is one‑token lookahead, which allows the parser to check whether the token "now" exists before deciding which command to execute.
However, the parsing mechanism provided by Ring’s brace‑based classes does not support such lookahead.
Using BraceNewLine() solves this problem by buffering tokens instead of making execution decisions token by token. The decision is deferred until BraceNewLine, where the full command is visible and the correct action can be chosen.

Ring is designed to make it possible to build a library like the Natural Library on top of these features, allowing us to define new domain‑specific languages quickly.
The advantage of this approach is that we can create DSLs with custom or natural syntax while still being able to mix these DSLs with normal Ring code. In other words, our DSLs can fully benefit from Ring’s features and supported programming paradigms.


Greetings,
Mahmoud

Mansour Ayouni

unread,
Jan 4, 2026, 12:23:13 PM (7 days ago) Jan 4
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

 The decision is deferred until BraceNewLine, where the full command is visible and the correct action can be chosen.

I definitely love that and confirm it was one of the main constraints I found when I tried to use NaturalLib in modeling natural language expressions in stzNatural.

Thank you very much!
Best,
Mansour


Mahmoud Fayed

unread,
Jan 4, 2026, 12:39:40 PM (7 days ago) Jan 4
to The Ring Programming Language
Hello Mansour

>> "I definitely love that and confirm it was one of the main constraints I found when I tried to use NaturalLib in modelling natural language expressions in stzNatural."

You are welcome :D

Ring 1.25 focuses on the main goals behind the Ring language.

(1) Easy translation of the language syntax. 
Our friend Hassan Harbi provided valuable reports and suggestions that helped guide this work.

(2) Improving Natural Language Programming support. 
After reviewing some of your SoftanzaLib examples shared in the group—especially your use of the underscore after certain Ring keywords (like “To”) to avoid collisions, and your use of @ before keywords—I decided to enhance both the Ring language and the Natural Library. 
The goal is to provide a more natural and expressive style that matches the spirit of the language.

Today, more programmers rely on AI to generate source code. 
They write prompts in natural languages such as English or Arabic, which improves writability. 
However, the generated code is still produced in programming languages that were not designed for this purpose. 

This means the readability of traditional programming languages does not match the natural level of writability achieved when using large language models.

Ring addresses this gap on two levels: 
(1) natural language programming through new DSLs that use natural code
(2) PWCT2 visual programming language (Interactive textual-to-visual code conversion)

By combining AI‑generated code with DSLs written in natural code, and later supporting them with visual components in PWCT2, we move closer to an era of programming that reflects the way humans naturally express ideas.

Greetings,
Mahmoud

Mansour Ayouni

unread,
Jan 4, 2026, 1:31:19 PM (7 days ago) Jan 4
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

After reviewing some of your SoftanzaLib examples shared in the group

One of the strengths of this Ring project is your sense of care of what the language users face as challenges and your ability to solve them at a foundation level!

I'm so happy.

Thank you Mahmoud.
Best,
Mansour

Mahmoud Fayed

unread,
Jan 4, 2026, 2:06:46 PM (7 days ago) Jan 4
to The Ring Programming Language
Hello Mansour

>> "One of the strengths of this Ring project is your sense of care of what the language users face as challenges and your ability to solve them at a foundation level!"
>> " I'm so happy."

Thanks for your kind words :D

Before starting Ring as a programming language, I was aware of a fundamental problem: in the modern era, a programming language needs a rich ecosystem of libraries to be useful and practical. Without libraries, who will use the language? And if the available libraries are merely wrappers around another language, then why would a developer choose your language at all?

This led me to realize that a good programming language is one that encourages developers to build libraries for it, and that these libraries should offer genuinely new experiences. In other words—as has often been said—a good programming language helps you see programming differently and solve problems in a better way. This “better way” is often reflected in how solutions are shaped and in the characteristics of the final application or software.

The Ring philosophy is to build libraries and DSLs first, then build your software on top of them. These libraries and DSLs can take advantage of Ring’s unique features to reach new levels of natural, declarative code.

That’s why your five years of work on SoftanzaLib means so much to me. You are a professional developer with decades of experience building mission‑critical software, and your decision to adopt Ring—and then extend it through SoftanzaLib—is an important success story in the Ring community. I am confident that your continued work will attract even more developers. The adoption of Ring and SoftanzaLib by ESPA‑MT is one clear example.

Ring is designed as a general‑purpose language for building applications, tools, and DSLs. 
My own goals focus on Visual Programming, Arabic translation, DSL design, and similar areas. 
But the true success of a programming language comes when passionate developers push it forward in the domains they care about.

Our friend Bert Mariani is developing many applications in Mathematics and Simulation.
Our friend Ahmed Hassouna is spreading the word about the language through Arabic videos, helping introduce Ring as an entry point to programming.
You (Mansour Ayouni) are developing SoftanzaLib to push Ring forward in Computational thinking, Education, and Professional application development.
Our friend Ilir Liburn has spent years improving Ring’s performance and features to support Game Development.
Our friend Youssef Saeed is building packages that strengthen Ring for Web Development.
Our friend Azzedine Remmal is creating extensions that enable using Ring for Machine Learning.
Our friend Mohannad Al‑Ayash is developing packages and applications for Mobile Development.
Our friend Ahmad Fayed has expanded Ring’s support for Embedded Systems and the Raspberry Pi Pico.

Each person has their own vision for how Ring should evolve and where it should be used. Another example that comes to mind is our friend Mohammed Ghanem, who used Ring to rewrite his Arabic Poetry Analysis application (migrating it from VB to Ring), and then wrote an Arabic book about it. This is a great example of Ring being used for Text Processing.

That is exactly what Ring was designed for—to help developers achieve their technical dreams. 
The dream belongs to you; you imagine it, and then you bring it to life.

Another part of my mission in Ring’s design and development is to ensure it remains a language that can last for many decades. This is why it is open‑source, portable, lightweight, simple, and comes with visual implementation—so that even a small number of dedicated programmers can keep the language alive.

Greetings,
Mahmoud

Mansour Ayouni

unread,
Jan 4, 2026, 2:33:36 PM (7 days ago) Jan 4
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

A deeply touching message that truly moved my heart. It made me realize that I am not alone in my dream, but accompanied by many brilliant minds who share a strong culture of commitment and dedication—one that you have successfully nurtured through your leadership, kindness, and genuine love of programming.

Each time, Ring unveils a part of my old programming dreams. I can’t even count the number of innovations that gave me that “aha” moment—when I suddenly thought: oh, now this will be possible to do!

The latest of these moments was when Mouhanned delivered RingQML. It instantly brought me back to my small room in 2009, when I was a young programmer in Canada and the first release of QML was made by Trolltech (the original company behind Qt).

I started learning QML with nothing but pen and paper, designing many user interfaces that way. Yet, in the end, I found myself constrained by the complexity of C++ and JavaScript. I simply couldn’t fully express all the innovative ideas I had about GUI development

Hopefully, now I have Ring to make it happen.

image.png

Antonio F.S.

unread,
Jan 4, 2026, 2:44:43 PM (7 days ago) Jan 4
to ring...@googlegroups.com

Hello everyone.

Masterful comments, Mahmoud.

Kind regards, Antonio F.S.


-------------------------------------------------------------------

El 4/1/26 a las 20:06, Mahmoud Fayed escribió:

Antonio F.S.

unread,
Jan 4, 2026, 2:48:31 PM (7 days ago) Jan 4
to ring...@googlegroups.com

Hello everyone.

Thank you for sharing, Mansour.

Kind regards, Antonio F.S.

---------------------------------------------------------------------

El 4/1/26 a las 20:33, Mansour Ayouni escribió:

Mahmoud Fayed

unread,
Jan 4, 2026, 2:50:08 PM (7 days ago) Jan 4
to The Ring Programming Language
Hello Mansour, Antonio

You are welcome :D

Greetings,
Mahmoud

Reply all
Reply to author
Forward
0 new messages