<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Today I noticed 8339217 (`loadConstant` overloads for `int`, `long`, etc.) come across, which is great (I was just thinking of writing an email to complain about a lack of this and possibly propose a PR for it).</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">However I have one other frequent headache around loading constants, and that is the fact that I am very frequently finding myself loading constants for `Constable` objects which do not also implement `ConstantDesc`. Thus I find myself frequently typing the sequence `.describeConstable().orElseThrow()`. The most common offenders are `Class`, `MethodType`, and `MethodHandle`.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I find this problematic not only because of the repetitive typing, but also because if I want to actually provide some consistent exception message I have to write a utility method, which I would then likely need to replicate since I use this pattern quite often.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I would like to propose a `loadConstant(Constable)` variant, which throws a reasonably descriptive exception when the `Constable` cannot be described.</div><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">One problem with such a proposal is that if there are overloads for both `ClassDesc` and `Constable`, then anything implementing both would cause a compilation issue.  So maybe this could be done as `loadConstable(Constable)` or `loadConstantOrElseThrow(Constable)` to avoid the overload ambiguity?</div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">If this proposal makes sense in any form, then I could open a bug and propose a PR, if that is OK.</div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">- DML • he/him<br></div></div></div>