Better way - %Library.CompiledClass instead of %Dictionary.ClassDefinition. Cache creates objects by %Library.CompiledClass which ar image of %Dictionary.ClassDefinition on compilation moment.

Yes, no problem:

USER>w $a($lb(123),2)
4
USER>w $a($lb("123"),2)
1
USER>w $a($lb(-123),2)
5
USER>w $a($lb(123.0),2)
6
USER>w $a($lb(-123.0),2)
7

Hi, Timur

I do not have much experience making obstacles for mumpsters. Let those who are engaged in it knows better than me.