HNHacker News
TopNewBestAskShowJobs

nivyed

5 karma · joined June 13, 2015

submissionscomments
nivyed··on Don't defer Close() on writable files (2017)
The article suggests using a named return value `err` to allow the return value of `Close` to be be propagated - unless doing so would overwrite an earlier error:

    defer func() {
        cerr := f.Close()
        if err == nil {
            err = cerr
        }
    }()
Wouldn't it be better to use `errors.Join` in this scenario? Then if both `err` and `cerr` are non-nil, the function will return both errors (and if both are `nil`, it will return `nil`):

    defer func() {
        cerr := f.Close()
        err = errors.Join(err, cerr)
    }()
nivyed··on HUSL – A human-friendly alternative to HSL
Does anyone know why HUSL is based on CIELUV rather than CIELAB?

It seems that, although CIELUV and CIELAB were considered equally good when adopted in 1976, CIELAB has generally been preferred more recently (e.g. for the 1994 and 2000 "Delta E" formulae [1]).

[1] https://en.wikipedia.org/wiki/Color_difference#Delta_E