News for hackers. Stuff that matters.
Re:Isaacs: try/catch is an anti-pattern by colanderman on Monday November 14, 2011 @09:32AM (#3234064)
I think a lot of programmers use try/catch when what they really want is Prolog-style failure:

  my_parser(String, Output) :-

    parseJSON(String, JSON),

    extract_the_values_I_want(JSON, Output).

 if my_parser(String, Output) then

  ...do stuff with Output...

 else

  ...show user "couldn't parse" message...
I've been using Mercury (a strongly typed Prolog) for years now and have never once found the need for exceptions (which Mercury supports) to indicate anything other than catastrophic failure.
Re:Isaacs: try/catch is an anti-pattern by sgt on Monday November 14, 2011 @01:02PM (#3234949)
What are your motivations for using Mercury? Are you using it for hobby projects, research/academic purposes or actual production code?
Re:Isaacs: try/catch is an anti-pattern by colanderman on Monday November 14, 2011 @01:37PM (#3235093)
Hobby projects and hobby research. It has some pretty intense features if you're into type theory.

IMO the library support isn't yet there for production code (e.g. no or only rudimental GUI/networking code). But if you're just using it for computation (e.g. AI or compiling or some such) it's pretty solid, and its FFI is the most straightforward I've ever seen.

FWIW I hear that these people: http://www.missioncriticalit.com/ and these people: http://www.princexml.com/ use it for production code, but I don't know much about them, beyond that Håkom Wium Lie (of CSS and Opera fame) is the Director of the latter.

I maintain a blog about Mercury's features for interested users: http://adventuresinmercury.blogspot.com/ if you're interested.

Re:Isaacs: try/catch is an anti-pattern by sgt on Wednesday November 16, 2011 @07:01AM (#3242779)
I'm definitely interested. Thanks. I've now bookmarked your blog.