News for hackers. Stuff that matters.
Re:When or If by darrinmn on Monday March 14, 2022 @01:38PM (#30675404)
It saddens me whenever a core web spec picks a sub-optimal solution purely because a 3rd party tool already picked the optimal one.

I find it ironic that the css "when/else" draft spec uses "if" for describing the conditional scenarios in plain english. As if the spec itself admits the syntax they are choosing is clearly sub-optimal.

Re:When or If by adastra22 on Monday March 14, 2022 @06:09PM (#30679094)
Would if/else have been considered optimal to you if you hadn’t already been conditioned (ha!) that way by other programming languages?

“When” actually seems better in a purely declarative language.

Re:When or If by andreareina on Monday March 14, 2022 @11:43PM (#30681444)
Maybe it's prior exposure to lisp, but I wouldn't expect "when" to have an "else" clause. Can't think of an idiomatic natural-language case with that structure either.
Re:When or If by IshKebab on Tuesday March 15, 2022 @02:25PM (#30688988)
I have never used SASS and if/else is obviously better than when/else.
Re:When or If by veidelis on Monday March 14, 2022 @02:52PM (#30676503)
It was the same with Array includes and contains, wasn't it?
Re:When or If by kretaceous on Monday March 14, 2022 @02:58PM (#30676603)
Also, Array.flat was chosen instead of Array.flatten because of a popular 3rd party library's function of the same name. I think it was Lodash.
Re:When or If by abdusco on Monday March 14, 2022 @03:05PM (#30676724)
Re:When or If by mananaysiempre on Monday March 14, 2022 @04:06PM (#30677528)
... And underscore/lodash use the _(...) wrapper approach pioneered by jQuery’s $(...) precisely to avoid monkey-patching builtin objects like Mootools did (as well as some others I think, but I don’t really remember).
Re:When or If by Izkata on Monday March 14, 2022 @04:46PM (#30678044)
PrototypeJS also had the monkey-patch approach.