Re: [Haskell-cafe] looking for origin of quote on preprocessors and language design
Haskell doesn't *need* preprocessors, but they sure make a lot of things easier. There are three I use regularly (c2hs, cpphs, noweb), and each serves a purpose which isn't directly supported by plain Haskell: c2hs -- Supports generating foreign function imports and wrappers based on C header files. This is simpler and less prone to cross-platform type errors than writing the declarations in Haskell, which generally requires a cpp-style #if..#else..#endif preprocessor anyway. cpphs -- The C preprocessor, adapted to Haskell syntax. I'd like to replace my uses of it with Template Haskell, but TH's limitation that its splices can't be defined in the same file make it (for my purposes) essentially useless. cpphs is text-based, which means you can glue together pretty much anything and let the compiler verify that it type-checks. noweb -- True literate programming (as opposed to .lhs verbose commenting), which allows sections of the source code to be re-arranged arbitrarily. I suppose it's possible in theory for a language to support this without a preprocessing step, but (to my knowledge) not even LISP derivatives do/can. On Thu, Jan 7, 2010 at 04:32, Johannes Waldmann waldm...@imn.htwk-leipzig.de wrote: Dear all, It's not exactly Haskell-specific, but ... I am trying to track down the origin of the proverb the existence (or: need for) a preprocessor shows omissions in (the design of) a language. I like to think that in Haskell, we don't need preprocessors since we can manipulate programs programmatically, because they are data. In other words, a preprocessor realizes higher order functions, and you only need this if your base language is first-order. Yes, that's vastly simplified, and it does not cover all cases, what about generic programming (but this can be done via Data.Data) and alex/happy (but we have parsec) etc etc. Best regards, J.W. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] looking for origin of quote on preprocessors and language design
Dear all, It's not exactly Haskell-specific, but ... I am trying to track down the origin of the proverb the existence (or: need for) a preprocessor shows omissions in (the design of) a language. I like to think that in Haskell, we don't need preprocessors since we can manipulate programs programmatically, because they are data. In other words, a preprocessor realizes higher order functions, and you only need this if your base language is first-order. Yes, that's vastly simplified, and it does not cover all cases, what about generic programming (but this can be done via Data.Data) and alex/happy (but we have parsec) etc etc. Best regards, J.W. signature.asc Description: OpenPGP digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] looking for origin of quote on preprocessors and language design
Hello Johannes, Thursday, January 7, 2010, 3:32:03 PM, you wrote: the existence (or: need for) a preprocessor shows omissions in (the design of) a language. yes, that's the common opinion. the same true for comments and identifiers :D shortly speaking, preprocessor is just another language on top of our one that has poor integration with main language. this partly solved by so-called syntactical preprocessors and even typeful ones (like Template Haskell) otoh there is no perfect language that is able to express any constraint. so preprocessor, applied to any given language, provides us additional level of expressiveness. so when you have some concrete problem that may be expressed in A only with preprocessor and in B as is - B is definitely better. if you typically write your programs in C++ w/o using preprocessor, and in C - with it, C++ is better. but when your programming level increases, you may go higher expressiveness of language you are using and start to need use of additional preprocessors. so if some language Pascal typically used without preprocessor and some language C - with it, it may just mean that C users are much more experienced and need more expressive power than Pascal ones -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] looking for origin of quote on preprocessors and language design
Hello Bulat, Thursday, January 7, 2010, 4:03:07 PM, you wrote: the existence (or: need for) a preprocessor shows omissions in (the design of) a language. forget to add: for language designers, analysis of typical preprocessor usage and adding analogous features to language instead is a great source of inspiration. in particular C++, D and other C descendants used it a lot -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] looking for origin of quote on preprocessors and language design
It strikes me that this question may be related (perhaps distantly) to Godel's incompleteness theorem. Anyone else see similarities here? On Thu, Jan 7, 2010 at 7:32 AM, Johannes Waldmann waldm...@imn.htwk-leipzig.de wrote: Dear all, It's not exactly Haskell-specific, but ... I am trying to track down the origin of the proverb the existence (or: need for) a preprocessor shows omissions in (the design of) a language. I like to think that in Haskell, we don't need preprocessors since we can manipulate programs programmatically, because they are data. In other words, a preprocessor realizes higher order functions, and you only need this if your base language is first-order. Yes, that's vastly simplified, and it does not cover all cases, what about generic programming (but this can be done via Data.Data) and alex/happy (but we have parsec) etc etc. Best regards, J.W. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe