Better HN
topnewbestaskshowjobs
Log inSign up

nivyed

5 karma · joined Jun 13, 2015 (11y ago) · 4 submissions

Submissions

comment 2y ago · link · parent

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)
    }()

comment 11y ago · link · parent

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