About two Ring questions.

51 views
Skip to first unread message

Antonio F.S.

unread,
Jun 18, 2024, 11:58:56 AMJun 18
to The Ring Programming Language
Hello colleagues of the precious Ring language. :-)

Now that I'm on holiday I can have a few days to take another look at
Ring. How wonderful!
However it would be very interesting to be able to transpile for the web
to JS, and as I haven't reached that point of researching the Ring
documentation, is there such an option or is it in the pipeline to be
integrated in later versions? Another question would be if in the same
way, you could contemplate the option of having statically declared
variables.

Best regards.
Antonio F.S.

Irwin Rodriguez

unread,
Jun 18, 2024, 1:12:25 PMJun 18
to The Ring Programming Language
Hi Antonio,

>>  "However it would be very interesting to be able to transpile for the web to JS"

There's no a transpiler for JS and I don't think it is in the plans for the future. However, the ring language specifications and the tokensLib are a good starting point for those who decide to create their own.

>> " the option of having statically declared variables"

You can use the TypeHints library to add the type information. 

regards.

Ilir Liburn

unread,
Jun 19, 2024, 3:21:54 PMJun 19
to The Ring Programming Language
Hello Antonio,

>>  "However it would be very interesting to be able to transpile for the web to JS

Ring is a high level language. It is difficult to transpile to another high level language because each high level language defines its sets of the rules (implicit type conversion for example). It is much simpler to talk about high level to low level language translation because Ring is written in it (C language in this case).

>> " the option of having statically declared variables"

Each global variable is a static variable. You're probably asking about the static member of the class. That's simple, you only have to create a variable having the same name like the class

MyClassAndStaticMember = new MyClassAndStaticMember
MyClassAndStaticMember.myStaticMember = 123

class MyClassAndStaticMember
myStaticMember

and then you load it as a file

load "staticmember.ring"

object = new MyClassAndStaticMember

? MyClassAndStaticMember.myStaticMember

? object.myStaticMember

Last line is showing you that myStaticMember is also accessible through object instance (prints NULL instead of 123).
This is incorrect, static member should be accessible only trough class identifier, not the object instance.
However, there is a solution to this (by using the package and import keywords).

Greetings,
Ilir

Antonio F.S.

unread,
Jun 22, 2024, 3:10:21 AMJun 22
to ring...@googlegroups.com

Ok. Thank you.

Regards.

Antonio F.S.

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

El 18/6/24 a las 19:12, Irwin Rodriguez escribió:
--

---
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/8f67d9e8-02b6-4e13-8138-4b19f52de6den%40googlegroups.com.

Antonio F.S.

unread,
Jun 22, 2024, 3:10:21 AMJun 22
to ring...@googlegroups.com

Hello Ilir.

As always, your answers are definitely clear and resolute.

Thank you very much.
Best regards.

Antonio F.S.

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

El 19/6/24 a las 21:21, Ilir Liburn escribió:
--

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

Ilir Liburn

unread,
Jun 22, 2024, 4:54:29 AMJun 22
to The Ring Programming Language
Hello Antonio,

You're Welcome.

Greetings,
Ilir
Reply all
Reply to author
Forward
0 new messages