News for hackers. Stuff that matters.

nivyed

Re:Don't defer Close() on writable files on Tuesday September 10, 2024 @08:59AM (#41500349)
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)
    }()
Re:HUSL – A human-friendly alternative to HSL on Saturday June 13, 2015 @07:58PM (#9713236)
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