An other example in embracing Python semantics in Ring with Softanza

39 views
Skip to first unread message

Mansour Ayouni

unread,
Aug 27, 2023, 8:00:29 AM8/27/23
to The Ring Programming Language
Hello Mahmoud and All,

In Python we can write:

'
something = true // or false
value = "foo" if something else "bar"
'


As you might imagine, its equivalent in pure Ring is:

something = true // or false
if something = true
        value = "foo"
else
        value = "bar"
ok


But what if we write it, the Python-way, in Ring, using Softanza?

To to that, we just need to decorate the Python code with vr(), vl(), _if(), _else() and v() functions:


bSomething = TRUE
vr([ :value ]) '=' vl([ "foo" ]) _if(bSomething) _else([ "bar" ])
? v(:value)
#--> foo


And if we turn bSomething to FALSE:


bSomething = FALSE
vr([ :value ]) '=' vl([ "foo" ]) _if(bSomething) _else([ "bar" ])
? v(:value)
#--> bar


A snapshot of the sample in Ring Notepad:

image.png


All the best,

Mansour

Mahmoud Fayed

unread,
Aug 27, 2023, 3:23:25 PM8/27/23
to The Ring Programming Language
Hello Mansour

Thanks for sharing :D

Greetings,
Mahmoud

Bert Mariani

unread,
Aug 27, 2023, 4:12:49 PM8/27/23
to The Ring Programming Language
Hello Mansour

In computer hardware instructions, use usual method is:

  compare  value-X, value-Y             // results in a condition code:   cc = -1 ,0, 1
  branch     cc =  0, to address-A     // equal
  branch     cc = -1, to address-B     // less-than
  branch     cc =  1, to address-C    // greater than

Simple, straightforward.

Mansour Ayouni

unread,
Aug 27, 2023, 5:07:23 PM8/27/23
to Bert Mariani, The Ring Programming Language
Hello Bert,

Nice to know it. Thanks for sharing.

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/5f1932b4-51db-46c4-b993-113505067cf8n%40googlegroups.com.

Azzeddine Remmal

unread,
Aug 27, 2023, 9:10:07 PM8/27/23
to The Ring Programming Language
Hello Mansour
Thanks for sharing
I haven't used Softenza but it looks powerful and attractive in design
When do you issue it for use
Greetings

Mansour Ayouni

unread,
Aug 28, 2023, 5:27:16 AM8/28/23
to Azzeddine Remmal, The Ring Programming Language
Hello Azzeddine,

Thank you for your nice feelings!

I'm deploying tremendous efforts in the library as soon as possible. Actually, I'm battle-testing it in a large real world project, and making the necessary corrections so you can find it useful and powerful.

Please stay tuned.

Best,
Mansour

Reply all
Reply to author
Forward
0 new messages