r/ProgrammingLanguages • • Oct 05 '21

An old school BASIC interpreter - reposted from retrocomputing

/r/retrocomputing/comments/q21w12/an_old_school_basic_interpreter/
13 Upvotes

8 comments sorted by

View all comments

Show parent comment

2

u/ThomasMertes Oct 07 '21 edited Oct 07 '21

There is a page about repeating a string at Rosetta Code. None of the BASIC examples uses * for string multiplication. In almost all BASIC examples a loop is used. In some BASIC examples there is a function for string multiplication:

  • BBC BASIC has STRING$(5, "ha")
  • PowerBasic has REPEAT$(5, "ha")
  • TI-99 Extended BASIC has RPT$("ha", 5)

Other (non-BASIC) languages support * for string multiplication:

  • Ada has 5 * "ha"
  • Algol 68 has 5 * "ha"
  • Brat has "ha" * 5
  • Crystal has "ha" * 5
  • E has "ha" * 5
  • Groovy has 'ha' * 5
  • jq has "ha" * 3'
  • Kotlin has "ha" * 5
  • Lasso has 'ha'*5
  • Monte has "ha" * 5
  • Nanoquery has "ha" * 5
  • Pike has "ha"*5
  • PowerShell has "ha" * 5
  • Python has "ha" * 5
  • Ruby has "ha" * 5
  • Scala has "ha" * 5
  • Sidef has 'ha' * 5
  • Wren has "ha" * 5
  • zkl has "ha" * 5

By the way: Seed7 has "ha" mult 5 :-)

2

u/[deleted] Oct 07 '21

I guess S * N wins then.

(BTW the jq example might need a fix, unless it has a rather bizarre way of writing 5.)

1

u/ThomasMertes Oct 07 '21

I guess S * N wins then.

Yes, but this concerns only non-BASIC programming languages (and I just looked at usages of the operator *). For Bas7 and PyBasic this win should not have any effect.

Bas7 is a BASIC interpreter for historic BASIC dialects. The features of Bas7 come from several old BASIC dialects. On the page that describes Bas7 I write:

Unlike many other BASIC interpreters it does not try to introduce incompatible features.

In other words: I have no plans to introduce features for a vendor-lock-in towards Bas7. For Seed7 my view is different. :-)

If no historic BASIC interpreter supports string multiplication with * I will not introduce it in Bas7.

I also think that PyBasic should remove this feature unless they find some historic BASIC that supports it (and then Bas7 will also support it).