"RokuKC" wrote:
BrightScript is not BASIC.
BrightScript is a dialect of BASIC, extending it as a scripting language (dynamic types), i.e. in general direction of VBScript and VBA.
I would like to think "because RokuAnthony wrote it" is not the sole reason we are using B/S on Roku - but rather^ because it's easy to pick up by people coming from VB background. TRS-80 "Level II BASIC" - for which AJW wrote a simulator back in the days - is a BASIC, right? Besides the genealogical connection, it's easy to trace the BASIC roots in the B/S core functionality, incl. idiosyncrasies like the dummy argument in the
pos() and
upTime() functions.
To that extent, what i said was it would be desirable -
>>> if practical <<< - to maintain the well-known functionality, which in the case of CHR(x) is to return a 1-char string for x in the ASCII range [0, 127].
The BrightScript Chr() behavior of returning empty string for 0 and other non-valid codepoints is intentional and was done with forethought.
Wait, we might have a misunderstanding here.
In what sense is \0 a "non-valid codepoint"? It is valid ASCII, valid Unicode, valid UTF-8, valid in JSON (see the
easy-to-read spec)... i think even in HTML (which points to Unicode definition of control characters, which points to "
C0 control codes"). The only one that takes exception to that is XML, can't have \0 there - which is fine, as long as you do XML only.
I'm not sure why you are attributing sarcasm or non-genuineness to my attempt to provide information. 😞
My apologies if i offended you, i was just objecting to what i perceived to be
an euphemism. To clarify the terms, if some behavior stems from underlying implementation (i.e. comes "bottom up"), that is "as implemented" and not "as designed". Was i wrong in assuming chr(0) = "" comes from shoring up the fact that B/S strings are currently implemented internally as
ASCIIZ?
(^) reverse Hanlon's ("assume benevolence or forethought...") or me being a Pollyanna?