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

Semantic patching with Coccinelle

Semantic patching with Coccinelle

Posted Jan 21, 2009 10:48 UTC (Wed) by Yorick (subscriber, #19241)
In reply to: Semantic patching with Coccinelle by Thue
Parent article: Semantic patching with Coccinelle

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.


(Log in to post comments)

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