Live data from Hacker News

Traps to Developers

qouteall.fun

11–20 of 113 posts

Re: Traps to Developers

#11
post #3

A recent trap for me: Regex semantics is subtly different across languages. E.g. a{,3} matches between 0 and 3 "a" characters in Python. In JavaScript it matches the literal string "a{,3}".

Honorable mention to [a-z], gotta be my favorite trap

Re: Traps to Developers

#12
post #6
post #3

A recent trap for me: Regex semantics is subtly different across languages. E.g. a{,3} matches between 0 and 3 "a" characters in Python. In JavaScript it matches the literal string "a{,3}".

Regex is more a technique than an actual specification. It would be best to find the time to go and read an introductory book about Theory of Computation where they explain the underlying mechanism.

[flagged]

Re: Traps to Developers

#14
post #12
post #6

Earlier quoted context omitted.

Regex is more a technique than an actual specification. It would be best to find the time to go and read an introductory book about Theory of Computation where they explain the underlying mechanism.

[flagged]

It's half a chapter in most books I know. Or a subset of this 1h MIT videos [0], but the instructor also explains Finite Automata which is the basic mechanism that does all the stuff.

[0]: https://www.youtube.com/watch?v=9syvZr-9xwk

Re: Traps to Developers

#15
post #12
post #6

Earlier quoted context omitted.

Regex is more a technique than an actual specification. It would be best to find the time to go and read an introductory book about Theory of Computation where they explain the underlying mechanism.

[flagged]

I'll assume sarcasm (from your comment history) but for people actually believing this first degree: good luck debugging an incorrect regex if you haven't practiced regexes. Especially if it was generated by an llm.

Re: Traps to Developers

#17
post #16

The part about C# volatile accesses using release-acquire ordering seems to be wrong if I read the C# docs correctly. "There is no guarantee of a single total ordering of volatile writes as seen from all threads of execution" https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...

>A volatile write operation prevents earlier memory operations on the thread from being reordered to occur after the volatile write. A volatile read operation prevents later memory operations on the thread from being reordered to occur before the volatile read

Looks like release/acquire to me? A total ordering would be sequential consistency.

Re: Traps to Developers

#18
post #8

The first "trap" on the page says "min-width: auto makes min width determined by content", but this is false outside of flex/grid. From MDN: "For block boxes, inline boxes, inline blocks, and all table layout boxes auto resolves to 0." https://developer.mozilla.org/en-US/docs/Web/CSS/min-width

CSS cascade for text properties more or less makes sense.

I have been unable to comprehend CSS layout from any perspective: page designer, implementer, user, anything. It must have someone in mind but I have no idea who I that is.

Re: Traps to Developers

#19
post #16

The part about C# volatile accesses using release-acquire ordering seems to be wrong if I read the C# docs correctly. "There is no guarantee of a single total ordering of volatile writes as seen from all threads of execution" https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...

Somewhat off topic, but what is a realistic example of where you need atomics with sequential consistency? Like, what useful data structure or pattern requires it? I feel like I've seen every other ordering except that one (and consume) in real world code.

Re: Traps to Developers

#20
post #3

A recent trap for me: Regex semantics is subtly different across languages. E.g. a{,3} matches between 0 and 3 "a" characters in Python. In JavaScript it matches the literal string "a{,3}".

Honorable mention to [a-z], gotta be my favorite trap

What's the trap for this one? I can't think of any engine that parses this to mean anything other than the letters a through z.
Post reply on HN