I think it would be a good idea as a follow on PR to update these implementations to avoid the use of ScalarValue.
I'll try find some time this week to do it (I need some coding time :) -- lots of reviewing so far)
Originally posted by @alamb in #1582 (comment)