Why is D unpopular?
Patrick Schluter
Patrick.Schluter at bbox.fr
Mon May 2 07:04:31 UTC 2022
On Sunday, 1 May 2022 at 13:35:46 UTC, Guillaume Piolat wrote:
[..]
> **slices**
> Go and Rust had it from the start, Nimrod got them etc.
> I unfortunately lack the time to do a complete research
> about prior, because it seems surprising to me no other native
> language had them before D. I have a strong feeling that like
> other successful features, the experience of D was strongly
> influencing other designs.
I discovered recently that one of the first language to have
slices was BASIC. Not Microsoft derived Basics but the lowly
Sinclair BASIC had something conceptually very close to slices.
From wikipedia
````
Unlike the LEFT$(), MID$() and RIGHT$() functions used in the
ubiquitous Microsoft BASIC dialects for home computers, parts of
strings in Sinclair BASIC are accessed by numeric range. For
example, a$(5 TO 10) gives a substring starting with the 5th and
ending with the 10th character of the variable a$. Thus, it is
possible to replace the LEFT$() and RIGHT$() commands by simply
omitting the left or right array position respectively; for
example a$( TO 5) is equivalent to LEFT$(a$,5). Further, a$(5)
alone is enough to replace MID$(a$,5,1).
````
and what's not mentioned in the wikipedia is that the slicing
also worked as lvalue. ´a$(5 TO 7)="12"´ was possible.
More information about the Digitalmars-d
mailing list