TodePond / DreamBerd

perfect programming language
https://dreamberd.computer
Other
11.46k stars 365 forks source link

better Right-To-Left script support #143

Open emilyyyylime opened 1 year ago

emilyyyylime commented 1 year ago

While attempting to write a DreamBerd program I ran into an interesting conundrum. As per the official style guide, I wanted to use my local currency of NIS (₪), as a string interpolation introducer. However, I was faced with the problem of \<X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​ REDACTED DUE TO RULE REGARDING REPRODUCABILITY OF ISSUES X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​X​>

A possible solution is adding better RTL support: (This example required the use of a Right-To-Left Mark to align text on the right of the row, and a Right-To-Left Override to reverse the direction of text. I suggest these characters should be ignored by the compiler)

‏‮print("שלום, {שם}₪!")

I am aware using a Right-To-Left Override seems to obscure and complicate the use of Right-To-Left DreamBerd. As there are no negatives to this solution, I trust it is the path we should follow

emilyyyylime commented 1 year ago

As a follow up, should we accept the following?

‏‮tnirp("שלום, {שם}₪!")

This example still includes the Right-To-Left Override character, it simply places the Latin characters in reverse order, to undo the effect of the override. This is more readable, but of course significantly less ergonomic, I feel like this is an open question

Magnogen commented 1 year ago

If we accept that second option, it would make sense to allow the following too

tnirp("!dlroW ,olleH")!
emilyyyylime commented 1 year ago

@Magnogen Well but there isn't any RTL Override in your example, so I don't see how it would make sense to accept it. However, if it were present (even without any RTL text) I think this should be accepted