User: Password:
|
|
Subscribe / Log in / New account

Semantic patching with Coccinelle

Semantic patching with Coccinelle

Posted Jan 20, 2009 22:41 UTC (Tue) by Thue (subscriber, #14277)
Parent article: Semantic patching with Coccinelle

it is written in OCaml, so the potential developer base is somewhat limited

Every programmer should learn to write ML or another functional language (OCaml is an object-oriented version of ML). It is the first language taught at the Department of Computer Science at University of Copenhagen, so there is at least some people who know it.

For some kinds of programs ML code is 1/3 the size of an equivalent imperative program, as well as more readable and easier to verify for correctness. ML has excellent compile time checking; If your ML program compiles it will usually also run correctly.

Many of the computer science students who learn ML keeps it as their favorite language. In my experience it is especially the best students who 'gets it' and likes ML.


(Log in to post comments)

Semantic patching with Coccinelle

Posted Jan 21, 2009 1:33 UTC (Wed) by padator (guest, #56235) [Link]

Argh, please no programming language flame war :)

Semantic patching with Coccinelle

Posted Jan 21, 2009 18:45 UTC (Wed) by felixfix (subscriber, #242) [Link]

I agree -- Valerie's statement is fact, not a wish or flaming. There simply aren't as many people who will modify the source as would be if it were in, say, Perl or Python or C itself.

All comments to the contrary are wishful thinking (If I had some ham, I could have ham and eggs, if I had some eggs) and begging for a language war.

Semantic patching with Coccinelle

Posted Jan 21, 2009 19:45 UTC (Wed) by rwmj (subscriber, #5474) [Link]

Learn something new ...

Semantic patching with Coccinelle

Posted Jan 21, 2009 20:32 UTC (Wed) by felixfix (subscriber, #242) [Link]

... and miss the point completely.

You remind me of people who criticize where I go on vacation and what I do. "You could have gone to xxx and done yyy." Yeh, well, no matter where I go and what I do, I could have gone somewhere else and done something else.

Time and resources are limited. Some people would rather get on with the doing rather than learn new ways to not do things they don't have time for because they spend all their time learning new ways they won't use.

Semantic patching with Coccinelle

Posted Jan 21, 2009 22:23 UTC (Wed) by rwmj (subscriber, #5474) [Link]

Yeah, you're right. We should never try anything new or do anything differently from how it's
always been done.

Semantic patching with Coccinelle

Posted Jan 21, 2009 23:49 UTC (Wed) by felixfix (subscriber, #242) [Link]

You just don't get it. There are more people who already know common languages than who already know OCaml, and only a fraction of those people who don't know OCaml are going to have the time and resources to learn it.

It's just a simple fact. It has nothing to do with the benefits of education, of new and improved ways of doing things. NOTHING.

Quit taking it personally. It has zero to do with you personally, your personal taste in languages or living styles, what would be best or ideal or anything. It is a simple fact of counting heads. More people know languages other than OCaml and could contribute in those languages.

Separate raw data from your personal wishes and dreams. Valerie wrote a fact. Dispute the fact if you want, but don't ramble on about learning and better ways and so on, those are not facts.

Semantic patching with Coccinelle

Posted Jan 23, 2009 1:37 UTC (Fri) by giraffedata (subscriber, #1954) [Link]

Looks to me like you're putting words in rwmj's mouth and then disagreeing with them. I don't see that rwmj has taken issue with Valerie's conclusions about the language choice.

Not every comment is a contradiction of the parent, and I wouldn't assume that "learn something new" was meant to say, "there's nothing unfortunate about the fact that this code is in OCaml."

Of course, I'm not really sure how "learn something new" does fit into the thread. The posts after it follow more obviously: you point out that learning something new isn't always the right thing and rwmj misreads that as learning something new is never the right thing and disagrees. While that position (learning something new is sometimes good) is obviously right, you respond as if he were arguing -- still -- that there's nothing unfortunate about the fact that this code is in OCaml.

Semantic patching with Coccinelle

Posted Jan 23, 2009 5:41 UTC (Fri) by rwmj (subscriber, #5474) [Link]

I was just being sarcastic in that second posting. OCaml and Haskell are something new. They're not just exotic scripting languages - in the way that Ruby is just Perl with a different syntax. They are something considerably more powerful and expressive that can take programming in new directions. Unfortunately explaining this is a bit like the Paul Graham explaining LISP to "Blub" programmers.

Semantic patching with Coccinelle

Posted Jan 23, 2009 8:09 UTC (Fri) by hppnq (guest, #14462) [Link]

Unfortunately explaining this is a bit like the Paul Graham explaining LISP to "Blub" programmers.

It's hard to find explanations that do a worse job of introducing people to Lisp. There's a good explanation of Haskell (PDF), including a bit of history, design choices and an overview of the functional programming paradigm.

Haskell, by the way, is roughly of the same age as Python, but is expected to become the next great programming language Any Moment Now. Or maybe not.

Semantic patching with Coccinelle

Posted Jan 22, 2009 6:49 UTC (Thu) by njs (guest, #40338) [Link]

No-one's saying that people *shouldn't* learn OCaml, or even that they personally don't wish to learn OCaml, just that in practice most of the people in the programming world perceive OCaml as exotic and do not learn it -- for whatever reason.

Writing in a niche language *can* have the opposite effect on finding contributors, though. Darcs for instance benefited quite a bit from being written in Haskell, because there were many people who had learned the language out of interest and really wanted to work on something in Haskell, but not many real-world projects to go around. Its competitors were written in better known languages, but their potential contributor base was correspondingly diluted by all the other projects also written in those languages...

This effect does exist but it's short-lived...

Posted Jan 22, 2009 10:29 UTC (Thu) by khim (subscriber, #9252) [Link]

Yes, darcs benefited for a time from the fact that it could attract all these people - but the end result was the same: when C crowd got it's shiny new bauble (Git) all other projects were left in dust...

Sometimes it's good idea to use non-mainstream language because it's the only way to produce something and you don't need many contributors: one of the most popular DFT library (FFTW) is written in OCaml (well, kinda). But it does limit number of potential contributors! No way to avoid this...

Semantic patching with Coccinelle

Posted Jan 21, 2009 10:48 UTC (Wed) by Yorick (subscriber, #19241) [Link]

First, many thanks to Valerie Henson for an excellent article and for reminding us of the existence of Coccinelle which appears to be a fine tool.

But I must agree with Thue. Statements on the form X is written in Y, so the potential developer base is somewhat limited where Y is a language not well-known by the speaker are misleading. Any competent and motivated programmer will quickly learn a language such as ML, Scheme or Haskell in order to contribute to a project.

We are not talking about exoticisms like Befunge or Brainfuck here but standard, well-known, well-documented and widely-taught languages. A notation well suited to the task makes the task easier; for nontrivial applications, the complexity lies in the problem domain. Anyone who has worked with GCC will attest that the fact that it is (mostly) written in C does not make it easier to understand.

Semantic patching with Coccinelle

Posted Jan 21, 2009 12:35 UTC (Wed) by hppnq (guest, #14462) [Link]

Statements on the form X is written in Y, so the potential developer base is somewhat limited where Y is a language not well-known by the speaker are misleading. Any competent and motivated programmer will quickly learn a language such as ML, Scheme or Haskell in order to contribute to a project.

This is not the common practice, of course, if only because there are a lot more incompetent programmers than programmers who quickly learn Haskell. Whether this is true for any language Y and any project X is an interesting question.

But of the statements S in publication P, I would say yours is more sweeping than Valerie's. ;-)

Semantic patching with Coccinelle

Posted Jan 22, 2009 4:11 UTC (Thu) by ncm (subscriber, #165) [Link]

Is OCaml standard now? Last I heard it was defined by its current implementation. Wikipedia seems to suggest that remains true.

A formal definition and multiple implementations help to reassure coders that time spent learning the language and writing reams of code in it won't end up wasted when, e.g., developers of the sole implementation lose interest and leave it orphaned. (NB: I am not saying I expect this to happen to OCaml.) It is precisely this quality, and nothing about the details of the language design, that make apt Ms. Henson's remark about Coccinelle's potential developer base.

Semantic patching with Coccinelle

Posted Jan 22, 2009 6:10 UTC (Thu) by shimei (guest, #54776) [Link]

I'm not going to take a side on whether OCaml limits the development base or not, but I don't think it'd be the lack of standardization stopping it in any case. Look at languages like python and ruby (or, *gasp*, PHP) that are quite popular and practical. None of those are standardized in any meaningful way, but they're doing just fine. Then look at a language like Haskell that has standardization and multiple high-quality implementations, but still sits on the sidelines of the software industry.

Semantic patching with Coccinelle

Posted Jan 22, 2009 5:43 UTC (Thu) by i3839 (guest, #31386) [Link]

You're right for (semi) long-term contributors. But for people who just want to make a quick fix or other small contribution a for them strange language is a sort of hurdle. Perhaps big enough to miss quite a few long-term contributors who normally would have started with something small.

That said, how the reception of outside contributions is by the main developers has a bigger impact than what language is used...

Semantic patching with Coccinelle

Posted Jan 22, 2009 10:37 UTC (Thu) by Yorick (subscriber, #19241) [Link]

Thank you, that is a valid objection; small contributions are likely to be inhibited by the use of an unfamilar language. But not all of them; trivial typo fixes, translations, ports, build and configuration changes etc do not require much understanding of the language. Nor do testing and reporting bugs, perhaps the most important class of small contributions.

But what I really wanted to challenge is the sad prevailing idea that some languages are "common" and the rest "strange". The statement in the article could be interpreted that way, although I am confident that Ms Henson does not suffer from that delusion herself. It is not helpful in making "uncommon" languages less so, even when this has great merit.

(Also, some "helpful" contributions that you receive as a maintainer of a free software package makes you wonder if the language-as-barrier is such a bad idea...)

Semantic patching with Coccinelle

Posted Jan 22, 2009 13:43 UTC (Thu) by hppnq (guest, #14462) [Link]

But what I really wanted to challenge is the sad prevailing idea that some languages are "common" and the rest "strange".

To prove your point, maybe you should write patches for Coccinelle so that it can produce semantic patches for OCaml?

Semantic patching with Coccinelle

Posted Jan 22, 2009 16:18 UTC (Thu) by rwmj (subscriber, #5474) [Link]

To prove your point, maybe you should write patches for Coccinelle so that it can produce semantic patches for OCaml?

OCaml actually supports the principle of semantic patching natively. You can perform almost arbitrary transformations of the abstract syntax tree at compile time, and this feature is used to implement interesting new features like Erlang-style bitstrings, type-safe access to databases, type-safe regular expressions, and much more.

Of course this is "strange" to many. (LISP programmers might recognise them as a very much more powerful version of LISP macros). But this is just one of the several ways that OCaml (and Haskell) are far beyond common programming languages.

Rich.

Semantic patching with Coccinelle

Posted Jan 22, 2009 16:28 UTC (Thu) by padator (guest, #56235) [Link]

> OCaml actually supports the principle of semantic patching natively.

This is not true. What you are talking about is different and is called
meta-programming. The need to refactor code is different. Even in OCaml
you often need to refactor code and there is no tool right now for OCaml
that does that. In fact we, in the coccinelle project, had in the past internally needed to refactor the coccinelle code and it was painful.

So I guess the comment of the other guy was right on the point; we decided to do
a semantic patching tool for C rather than a semantic patching tool for OCaml because there are more people writing C code :)

Semantic patching with Coccinelle

Posted Jan 23, 2009 0:42 UTC (Fri) by nix (subscriber, #2304) [Link]

Obviously, for symmetry, the thing to do is to write a semantic patching
tool (called, perhaps, ocamelle), in C, which carries out such
transformations on OCaml code. ;}

Semantic patching with Coccinelle

Posted Jan 23, 2009 5:38 UTC (Fri) by rwmj (subscriber, #5474) [Link]

I didn't mean that semantic patching was used in the same way as metaprogramming, but they are certainly analogous to each other. In one case, the transformed code is applied as a patch back on the source. In the other case, the transformed code is immediately passed to the compiler.

Anyhow .. for OCaml refactoring, Jane Street sponsored this project last summer. It's also something that Eclipse + the OCaml Eclipse plugin claims to do. I have not used either.

Semantic patching with Coccinelle

Posted Jan 22, 2009 6:36 UTC (Thu) by dirtyepic (subscriber, #30178) [Link]

Statements on the form X is written in Y, so the potential developer base is somewhat limited where Y is a language not well-known by the speaker are misleading. Any competent and motivated programmer will quickly learn a language such as ML, Scheme or Haskell in order to contribute to a project.

The point is that the total number of people who know ML or will learn it in the near future is less than the total number of people who know or will know C/python/etc, just as a book written in Ukrainian has a smaller potential audience than one written in English. You don't have to know Ukrainian to make that observation, just how to count.

Semantic patching with Coccinelle

Posted Jan 22, 2009 6:58 UTC (Thu) by padator (guest, #56235) [Link]

Sure, so let's all start writing chinese code.

Semantic patching with Coccinelle

Posted Jan 22, 2009 17:40 UTC (Thu) by dirtyepic (subscriber, #30178) [Link]

nah, let's complain about them not learning english instead. obviously if they were competent and motivated they would.

Semantic patching with Coccinelle

Posted Jan 22, 2009 12:21 UTC (Thu) by mjg59 (subscriber, #23239) [Link]

Any competent and motivated programmer can quickly learn a language such as ML, Scheme or Haskell in order to contribute to a project. However, pretty much every competent and motivated programmer I know would rather be necking Pimm's from the bottle than learning yet another language in order to satisfy somebody's academic preferences.

Semantic patching with Coccinelle

Posted Jan 23, 2009 0:40 UTC (Fri) by lysse (guest, #3190) [Link]

...and you, sir, win this thread. ;)


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds