-
Notifications
You must be signed in to change notification settings - Fork 43
Quirks
The BrightScript language has a whole bunch of quirks. This page attempts to capture them as I find them. In general, a quirk listed here is supported in the brs
project's interpreter.
BrightScript function
s and sub
s can accept 63 arguments, and the brs
project matches that. Including a 64th argument results in early argument types getting "forgotten". This typically presents as a Type mismatch
error where the first few arguments have type ?
, e.g.:
sub tooMany(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az, ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl)
print "BrightScript supports at most 63 arguments"
end sub
tooMany(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
Current Function:
005:* sub tooMany(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az, ba, bb
006: ' , ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm, cn, co, cp, cq, cr, cs, ct, cu)
007: print "BrightScript supports at most 64 arguments"
008: end sub
Type Mismatch. (runtime error &h18) in pkg:/testfiles/function-max-arg-length.brs(5)
005: sub tooMany(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az, ba, bb
Backtrace:
#1 Function toomany(a As ?, b As Dynamic, c As Dynamic, d As Dynamic, e As Dynamic, f As Dynamic, g As Dynamic, h As Dynamic, i As Dynamic, j As Dynamic, k As Dynamic, l As Dynamic, m As Dynamic, n As Dynamic, o As Dynamic, p As Dynamic,
q As Dynamic, r As Dynamic, s As Dynamic, t As Dynamic, u As Dynamic, v As Dynamic, w As Dynamic, x As Dynamic, y As Dynamic, z As Dynamic, aa As Dynamic, ab As Dynamic, ac As Dynamic, ad As Dynamic, ae As Dynamic, af As Dynamic, ag As Dyn
amic, ah As Dynamic, ai As Dynamic, aj As Dynamic, ak As Dynamic, al As Dynamic, am As Dynamic, an As Dynamic, ao As Dynamic, ap As Dynamic, aq As Dynamic, ar As Dynamic, as As Dynamic, at As Dynamic, au As Dynamic, av As Dynamic, aw As Dy
namic, ax As Dynamic, ay As Dynamic, az As Dynamic, ba As Dynamic, bb As Dynamic, bc As Dynamic, bd As Dynamic, be As Dynamic, bf As Dynamic, bg As Dynamic, bh As Dynamic, bi As Dynamic, bj As Dynamic, bk As Dynamic, bl As Dynamic) As Void
Unlike the official interpreter, including a 64th argument in brs
will result in a clear runtime error. Including many more arguments is likely to crash a Roku device, causing a sudden reboot. brs
doesn't shell out to shutdown -r
because that'd be really annoying. You'll just get an error message.