A plugin system in Ring: Easy.

29 views
Skip to first unread message

Mansour Ayouni

unread,
Jul 4, 2024, 11:45:38 PMJul 4
to The Ring Programming Language
Hello Mahmoud, Ilir, and All

I made a simple plugging system that extends a basic string class with an extended one, using the feature of Embedding Ring in Ring.

The programmer can enrich the string class with user-defined functions, written in a separate Ring file, conforming to a given convention.

Then, the plugin system dynamically loads the plugin files, and makes them callable from the extended string class using an Xf() function.

This exploration helped me define the strategy I'll use in Softanza V2 to provide it with a more lean and extensible design.

The main file (sample + implementation):

Plugins files (should be hosted under "\plugins\" folder

Best,
Mansour





Mahmoud Fayed

unread,
Jul 7, 2024, 10:35:59 AMJul 7
to The Ring Programming Language
Hello Mansour

I understand this feeling, when we discover a nice feature we try to use it :D

But, there are many options to use before using Ring State functions

1 - Eval() function
2 - Load Package command (loading files in another global scope)
3 - The Call command (Function Pointers)
4 - Reflection and meta-programming (AddAttribute(), AddMethod(), etc.)

These options are too much better than Ring State functions in most cases
Because it uses less memory, faster, easy to debug
Also, it's tested very well in other projects like PWCT2

In General, I prefer using Ring State function only in particular situations like running Ring programs inside an IDE that works on Mobile or WebAssembly.

Greetings,
Mahmoud 

Mansour Ayouni

unread,
Jul 7, 2024, 10:50:52 AMJul 7
to msfcl...@gmail.com, ring...@googlegroups.com

Hello Mahmoud,

I was thinking about those options too.

I'll make some experiments and let you know.

Best,
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 on the web visit https://groups.google.com/d/msgid/ring-lang/3acbc46b-0270-4ee2-ae8b-97eafdcbc1dcn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages