SSLContext.get_min_proto_version and SSLContext.get_max_proto_version are declared fun ref. Neither mutates anything. Both read _ctx and hand it to SSL_CTX_ctrl with a get command.
SSLContext is class val, and the pattern the library itself demonstrates is to configure a context and then hold it as val. examples/ssl-client-server-example/ssl-client-server-example.pony declares let _sslctx: SSLContext, which is val, and only ever calls client and server on it. A val context cannot call either getter:
receiver type is not a subtype of target type
let v = ctx.get_min_proto_version()
receiver type: SSLContext val
target type: SSLContext ref^
SSLContext val is not a subtype of SSLContext ref^: val is not a subcap of ref^
So two public, documented, tested methods cannot be called on the context shape a caller following the example holds.
Fix direction
fun ref becomes fun box on both getters. That is additive: box accepts every receiver ref accepts and adds val and box. Existing ref callers keep working, the null guard still compiles, and the test suite still passes.
The setters are correctly fun ref. They change the context's protocol bounds through the C pointer, and a val context should not be able to call them. Only the getters have the wrong capability, and they most likely got it by being written next to the setters.
SSLContext.get_min_proto_versionandSSLContext.get_max_proto_versionare declaredfun ref. Neither mutates anything. Both read_ctxand hand it toSSL_CTX_ctrlwith a get command.SSLContextisclass val, and the pattern the library itself demonstrates is to configure a context and then hold it asval.examples/ssl-client-server-example/ssl-client-server-example.ponydeclareslet _sslctx: SSLContext, which isval, and only ever callsclientandserveron it. Avalcontext cannot call either getter:So two public, documented, tested methods cannot be called on the context shape a caller following the example holds.
Fix direction
fun refbecomesfun boxon both getters. That is additive:boxaccepts every receiverrefaccepts and addsvalandbox. Existingrefcallers keep working, the null guard still compiles, and the test suite still passes.The setters are correctly
fun ref. They change the context's protocol bounds through the C pointer, and avalcontext should not be able to call them. Only the getters have the wrong capability, and they most likely got it by being written next to the setters.