On Thu, 3 Apr 2025 12:14:52 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

>> That was intentional as the list is always `0..size` whereas a map can use 
>> arbitrary inputs. Is there a better way to illustrate this than what we have 
>> now?
>
> I guess my "beef" is that the examples for int function and function are 
> similar -- they use same class name. Reader might expect (as I did) that they 
> do the same thing, just using a different backing storage. But they don't -- 
> not only is the implementation tweaked to use function instead of int 
> function -- also what is cached changes subtly. I'm afraid this will be 
> difficult to follow for readers. If you want to highlight that the "function" 
> example has more freedom, I think we'd be better off with using another 
> example. For instance:
> 
> * use square(int)->int to show off int function/list
> * use square_root(int)->int to show off function/map

(e.g. stable int function is good for _total functions_ -- stable function is 
good for _partial functions_)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2026878559

Reply via email to