News for hackers. Stuff that matters.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by steveklabnik on Saturday June 15, 2019 @08:30PM (#20193078)
My understanding is that in production compilers, hand rolled parsers are the norm. Parsing libraries are cool, but just aren’t used for big projects.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by sanxiyn on Saturday June 15, 2019 @10:31PM (#20193493)
Both OCaml and GHC use parser generators. It is incorrect to suggest production compilers hand roll parsers.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by steveklabnik on Saturday June 15, 2019 @11:51PM (#20193749)
Two counterexamples does not disprove “a norm”. There are always exceptions!
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by nybble41 on Sunday June 16, 2019 @12:15AM (#20193814)
Right, to prove or disprove the norm one would need much more information. Two counterexamples does, however, disprove that "Parsing libraries ... just aren’t used for big projects." GHC and the OCaml compiler are both big projects, and they use parsing libraries.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by fnord123 on Sunday June 16, 2019 @04:50AM (#20194571)
I think big here means impactful.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by grumdan on Sunday June 16, 2019 @06:01AM (#20194762)
Describing two well-engineered compilers of two relatively used languages as not impactful is quite a statement. In particular, given the good performance results they achieve, for languages that are quite far away from the normal execution model of the machine they produce code for.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by fnord123 on Sunday June 16, 2019 @06:32AM (#20194842)
>two relatively used languages

Relative to what? Haskell and OCaml are important languages for PLT but not in the context of "production", or as I understood "production" to mean: shipping products with features. To call them anything but niche players in this context is not accurate in my opinion.

Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by grumdan on Sunday June 16, 2019 @07:02AM (#20194916)
As in, there are a handful of large projects the languages are used for. For Haskell, Facebook's spam detection system, Sigma[1], comes to mind, along with some use by banks (Standard Chartered); then there's a bunch of smaller places using Haskell (Wire, a secure messaging app, like Signal; Galois, a US defense contractor doing software verification and related things) plus some open-source tools like pandoc.

I know less about OCaml, but at least Jane Street is using it.

It's somewhat niche, but it's not like it's only used for hobby or toy applications.

[1] https://code.fb.com/security/fighting-spam-with-haskell/

Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by floatboth on Sunday June 16, 2019 @10:58AM (#20195763)
Facebook's static analyzer Infer https://fbinfer.com is written in OCaml.

There's a lot of OCaml in the program verification space: https://frama-c.com http://why3.lri.fr https://alt-ergo.ocamlpro.com

And for mysterious reasons, OCaml is now kinda popular for.. web frontends. Bloomberg created an OCaml-to-JS compiler https://bucklescript.github.io and Facebook (again!) created an alternative syntax https://reasonml.github.io and this combination is apparently a new hipster way of writing web apps.

Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by jcora on Sunday June 16, 2019 @07:09AM (#20194933)
I don't think language use industry-wide is a good metric for how relevant compiler software is. It is entirely imaginable that a very serious compiler that proves the original point exist for a language with very rare industry use.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by grumdan on Sunday June 16, 2019 @07:27AM (#20194974)
Another point is that Haskell and OCaml popularized features and styles that are making their way into mainstream languages (e.g. option types instead of null, immutability by default), and the compilers showed that they can be implemented efficiently.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by pyrale on Sunday June 16, 2019 @02:16PM (#20196997)
Both GHC and ocaml have a pretty good claim at being among the most influential compilers of their generation.

If you look at Java for instance, generics were made by one of the Haskell creators, and it has been implementing functional features for years now.

Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by tomasato on Saturday June 15, 2019 @10:18PM (#20193457)
Excluding the lens library (as per the article) is unusual, it provides natural getter/setter and row polymorphism type functionality.

More anecdotally, I’d argue parsing libraries are common, just look at the prevalence of attoparsec and others. But most parsing libraries in the ecosystem are parser combinator libraries which don’t support as performance and nice error messages that compilers need

Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by garmaine on Sunday June 16, 2019 @12:27AM (#20193836)
That was where I stopped reading. If a library like lens—used by nearly every haskeller in every project—was disallowed, I don’t know what the purpose of this exercise was.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by pyrale on Sunday June 16, 2019 @02:23PM (#20197044)
Lens is far from being used by everyone in the space. On a sample of 5-6 professional users I talked with at this zurihac, most didn't use it.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by aliceryhl on Sunday June 16, 2019 @05:01AM (#20194598)
I mean, it seems like it was an university course, and writing a compiler from scratch is probably a decent exercise in a compiler course.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by garmaine on Sunday June 16, 2019 @05:47AM (#20194709)
Restrict the students from using a parser library. I get that. But allowing nothing except that standard library? That’s stupid.

It also makes the language comparison useless. Python has a standard library that is continuously improved and people reach to that when writing programs. Haskell, like C, ossified it’s standard library when it was created and people use the external packages for equivalent up to date libraries.

Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by Ericson2314 on Sunday June 16, 2019 @05:44PM (#20198094)
Parsers are not the interesting parts of compilers.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by tathougies on Sunday June 16, 2019 @12:17PM (#20196230)
I dunno, libraries like earley in Haskell, provide pretty nice error messages.
Re:Comparing the Same Project in Rust, Haskell, C++, Python,... by willtim on Sunday June 16, 2019 @03:08AM (#20194248)
It depends entirely on whether the big project still has an elegant and complete formal grammar. Hand-rolled parsers are only common in industrial languages because many have grown to be far too complex and ad-hoc, requiring e.g. additional analysis and disambiguation during parsing. It is not a situation to aspire to.