In many circumstances, as much as we'd like it to be, creating a safe protocol that is verifiable at compile time is just not possible.
One example would be when the Key needed in a get has to be constructed at runtime (say by appending together other string only available at runtime by consuming some external source).
In all these circumstances we may feel that the burden of having to prove the compiler we have valid Keys is just too big and what we really wish for is a good ol' RuntimeException, something that would just make us feel at peace with the universe...
I'm thinking something like:
trait UnsafeStringP { self: StringP =>
final def get[A](key: String)(
implicit ev: NonNullBulkString ==> A
): Protocol.Aux[Option[A]] = {
require(key.nonEmpty, "why are you doing this to me now")
self.get(Key.unsafeFrom(key))
}
}
I'd also love to see this properly packaged under some very comforting namespace like hell or blinded (which I personally like a lot 'cause it plays well with laserdisc, i.e. import laserdisc.blinded._)
In many circumstances, as much as we'd like it to be, creating a safe protocol that is verifiable at compile time is just not possible.
One example would be when the
Keyneeded in agethas to be constructed at runtime (say by appending together other string only available at runtime by consuming some external source).In all these circumstances we may feel that the burden of having to prove the compiler we have valid
Keys is just too big and what we really wish for is a good ol'RuntimeException, something that would just make us feel at peace with the universe...I'm thinking something like:
I'd also love to see this properly packaged under some very comforting namespace like
hellorblinded(which I personally like a lot 'cause it plays well withlaserdisc, i.e.import laserdisc.blinded._)