Re:W3.css – A minimal alternative to Bootstrap
by Waterluvian on Tuesday September 13, 2022 @09:59PM
(#32832420)
Tangent: why is .match on Symbol? I read through string.match and looked at Symbol and I don’t understand why all these helpful functions exist on Symbol.
[ Parent
| on HN ]
Re:W3.css – A minimal alternative to Bootstrap
by jchw on Tuesday September 13, 2022 @10:05PM
(#32832464)
Symbol.match is not the match function, it is a Symbol which can be used as a property key on an object that is supposed to behave like a regular expression.
The purpose of having Symbol values is to ensure the property keys are unique and can't collide with string keys that predate new standards.
Re:W3.css – A minimal alternative to Bootstrap
by acdibble on Wednesday September 14, 2022 @05:42AM
(#32834998)
Also known as "well-known symbols".
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re:W3.css – A minimal alternative to Bootstrap
by Waterluvian on Thursday September 15, 2022 @08:34AM
(#32850828)
Ohhhh okay. So it’s just a flag describing expectations about an object. And as a Symbol it doesn’t interfere with any other part of the object such as properties or iteration.