[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#663180: Provides no zero value



Hello,

2012/3/10 Goswin von Brederlow <goswin-v-b@web.de>:
>>> I can't because the Sha1.t is abstract.
>>
>> I think what David means is that  you can just define
>>     let my_initializer = Sha1.string ""
>> somewhere at the beginning of your code.

Yes.

> let () = Printf.printf "%s\n" (Sha1.to_hex (Sha1.string ""))
> da39a3ee5e6b4b0d3255bfef95601890afd80709
>
> This would certainly work as an initializer but would not be obviously
> invalid.
[...]
> This on the other hand is easy to spot in output or when stored in
> files and unlikely to occur naturaly.

I don't buy your argument (only a human can spot the 0000 value) but I
understand your point of view.

Another option would be to use Some h | None in your initialization
code and convert it to an immutable value at the end of the
initialization.

Best regards,
d.



Reply to: