Inconsistency with Char
dryewo opened this issue · comments
How to reproduce:
=> (a/advance (a/compile [\A]) nil \A)
ClassCastException java.lang.Character cannot be cast to java.lang.Number automat.stream/to-stream/reify--19385 (stream.clj:70)
While this of course works:
=> (a/advance (a/compile [1]) nil 1)
And even this:
=> (a/advance (a/compile [\A]) nil 65)
Is there any fundamental reason for chars are mandatorily converted to ints when compilation happens?
This was to allow for regex-style compiled representations, where each code point is an index into an array. However, I agree that this is confusing, and should be an optional flag, if it continues at all.
pdf.ql.text> (a/advance (a/compile [\A]) nil \A)
{:accepted? true, :checkpoint nil, :state-index 1, :start-index 0, :stream-index 1, :value nil}
The char FSM no longer accepts the int input, which is good.
The seq impl of to-stream
has a separate issue that I might raise later, but I think this can be closed (same goes for #30).
Thanks, I haven't cleaned up the issues here in a while.