They mentioned why they ditched Auto Layout on obj.io
"If we switch to Apple’s Auto Layout APIs, we can do a little better: 34 lines of code. There is no longer any math or duplication — hurrah! But we’ve traded that for a different set of problems: Auto Layout is hard to set up, is difficult to debug, and suffers from poor runtime performance on complex hierarchies."
Hi, author here.
I think you partially missed the main purpose of the article, which for me was just having fun by playing with a language I'm currently learning.
I wasn't try to teach anything to anyone.
But I must say, thanks for the great feedback! Lots of stuff I didn't know that we'll make me write better Haskell code :)
Well, what you wrote is "The main reason I did it was to see what Haskell is capable of compared to other languages such as Python." The problem is that what you coded isn't what Haskell is capable of :)
It would be nice if you explicitly state you are learning Haskell in your article. If I'm a newbie and I see some of the awkward Haskell code(which I also make sometimes), I would feel discouraged. It doesn't seem Haskell is making things better.
I expect there to be lots of comments demonstrating tons of different styles of doing this stuff. Haskell is one of those languages where you can go back to your code 20 times and still find a new way of doing something.
He specifically said "since it was all inside a single tag". Without knowing what the payload of the tag is, its hard to say if regex was appropriate or not.
I'd say it's never appropriate to parse XML with a regex. Even if you're just looking for something "inside a single tag", there are just too many gotchas like entities, CDATA sections, etc. Why bother with (or forget) any of that when there are well-tested XML libraries for probably every language, and many languages have it in their standard library.
I think you and I are reading the statement differently. I did not read it as he was using regex to parse the XML; I read it as he as using regex to parse the text contents of a particular tag that he extracted using a standard XML parser.
Of course regex is appropriate in some cases. You parse XML with a standard API, then use a regex on the contents of a single tag. For all we know, inside the tag could have been "img: foobar", regex works great in that case.
Hey, thanks! That's @edwellbrook rocking the design. We had a conversation about open sourcing it but we ended up choosing not to, dealing with bad, bad guys just cloning the repo & submitting to App Store looks hard. :(