List Info

Thread: Re: "ocaml_beginners"::[] Learning camlp4




Re: "ocaml_beginners"::[] Learning camlp4
country flaguser name
United Kingdom
2007-05-21 07:55:46

On Mon, May 21, 2007 at 01:18:59PM +0300, dmitry grebeniuk wrote:
> Shalom, Richard.
>
> >> I learned revised syntax when tried to learn camlp4.
> >> I wanted to use camlp4 for fixing some unsafe issues in
> >> original syntax, but I've found that revised syntax already
> >> fixed these issues.
> RJ> What are these 'unsafe issues' in the original syntax?
>
> I'll cite from
>; http://caml.inria.fr/pub/docs/tutorial-camlp4/tutorial005.html
[snipped]

Nice list. Can't say I agree with everything on it, but the revised
syntax has some advantages.

The problem is that from experience I know that a different syntax
*is* a different language. Yes, I know, it's just a syntactic
difference and it probably only affects 10% of the compiler, and all
the rest is the same. But still, from a programming point of view
when I see a file written in the revised syntax, it's written in a
different language.

This has big implications for software engineering: Now I need to
train up programmers in two syntaxes (essentially, two different
languages as far as they are concerned). For no particular reason.
They'll be just as confused about the difference between 'value' and
'let' as they are about where they can omit ';;'. A programmer
dealing with code written in a mix of syntaxes has an extra mental
burden. If I have scripts which parse or generate code, now I have to
write those scripts twice over. If I'm writing new code, I have the
uncertainty of deciding which syntax to use.

The dominant syntax (original) has some quirks but is pretty good,
especially know I've learned all the ins and outs, and the revised
syntax sure ain't 10 times better. Which is what it would take to
persuade people to switch.

So, having two syntaxes for a language which anyway is struggling for
acceptance, that's just a really bad idea.

Oh yes, TWT ... that's *three* syntaxes.

Rich.

--
Richard Jones
Red Hat

__._,_.___
.

__,_._,___
Re Learning camlp4
country flaguser name
Moldova, Republic of
2007-05-22 03:38:40

Shalom, Richard.

RJ> But still, from a programming point of view when I see a
RJ> file written in the revised syntax, it's written in a
RJ> different language.

Yes, this is the main problem of all non-mainstream languages
(and especially for all non-mainstream dialects of
non-mainstream languages).
But hadn't you wrote syntax extensions to ocaml? They turn
ocaml into some other language, which should be learned too.

RJ> If I have scripts which parse or generate code, now I
RJ> have to write those scripts twice over. If I'm writing
RJ> new code, I have the uncertainty of deciding which
RJ> syntax to use.

At the time I learned revised syntax, I already had some
sources. Some of them are still compiling without changes
(and they are in original syntax), others was converted
using "-pp 'camlp4 pa_o.cmo pr_r.cmo".

RJ> The dominant syntax (original) has some quirks but is
RJ>; pretty good, especially know I've learned all the ins
RJ> and outs, and the revised syntax sure ain't 10 times
RJ> better.

Yes, no 10 times better. But I tried to think how could
I improve the revised syntax (its unambiguity and clearness),
and I had no ideas. (without changing semantics of language
or adding things that could be done by means of the language
itself). So now I think that revised syntax is the best
syntax for programming in ocaml. If you have ideas how to
improve it, I'll be glad to hear them. (small note: now I
think that parentheses and brackets are good, and
indentation should be used as something significant to
meaning of the program).

RJ> Which is what it would take to persuade people to switch.

I'm not so much persuading to switch. It's beginner's
list, so I hope somebody will learn revised syntax as the
main ocaml syntax.

RJ> So, having two syntaxes for a language which anyway is
RJ>; struggling for acceptance, that's just a really bad
RJ> idea.

Not very bad since they are easily converted between each
other.

RJ> Oh yes, TWT ... that's *three* syntaxes.

And one hundred more syntaxes which can be added by
camlp4. Adding new, even very small syntax extension
means the creation of new language. People think that
camlp4 is good, but revised syntax is bad. I can't
understand them.
My position on this topic is clear: I'm not using
camlp4 extensions to revised syntax (except maybe
pa_macro) and my sources are written "uniformly",
with very rare redefinitions of arithmetic operators,
"" and "**".

--
WBR,
dmitry mailto: gds-mlsts%40moldavcable.com">gds-mlstsmoldavcable.com

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )