Why define a struct with single private field of unit type?

You can’t create an instance of a struct if it has private fields. This is just a trick to prevent ParseBoolError from being constructed in user code.

One reason to do this is for forwards compatibility. If users could create it with:

let error = ParseBoolError {};

then a future version of ParseBoolError couldn’t add fields without breaking that code.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)