caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] syntaxes
@ 2002-10-04  7:40 Kontra, Gergely
  2002-10-04  8:32 ` Daniel de Rauglaudre
  2002-10-04  9:22 ` Pierre Weis
  0 siblings, 2 replies; 6+ messages in thread
From: Kontra, Gergely @ 2002-10-04  7:40 UTC (permalink / raw)
  To: caml-list

Hi!

I've seen so far, that there are at least 2 version of syntax exists.
My only question is: why has ocaml different syntax than standard ML at
the places, where ocaml is not more efficient.
Eg. it is the same as writing => and ->.
Sometimes SML solution is shorter.
Records in ocaml is not optimal. From a record creation, the type should
be obvious, so labels can be reused in different type of records. And
there is the let ... in ... end (Ada like) construct, which can be used
to avoid ambiguity, (My opinion, that it should be used in try ... with
... end and match ... end constructs, but forget it, uniform syntax may
be a more important point...) not talking about pattern matching in
function heads...

Gergo

+-[Kontra, Gergely @ Budapest University of Technology and Economics]-+
|         Email: kgergely@mcl.hu,  kgergely@turul.eet.bme.hu          |
|  URL:   turul.eet.bme.hu/~kgergely    Mobile: (+36 20) 356 9656     |
+-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+
.
Magyar php mirror es magyar php dokumentacio: http://hu.php.net

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] syntaxes
  2002-10-04  7:40 [Caml-list] syntaxes Kontra, Gergely
@ 2002-10-04  8:32 ` Daniel de Rauglaudre
  2002-10-04 10:58   ` Kontra, Gergely
  2002-10-04  9:22 ` Pierre Weis
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel de Rauglaudre @ 2002-10-04  8:32 UTC (permalink / raw)
  To: caml-list

Hi,

On Fri, Oct 04, 2002 at 09:40:47AM +0200, Kontra, Gergely wrote:

> I've seen so far, that there are at least 2 version of syntax exists.
> My only question is: why has ocaml different syntax than standard ML at
> the places, where ocaml is not more efficient.

We could answer: why "standard ML" has a different syntax than Caml?
Caml is as old as standard ML: we did not decide to differentiate.
Don't be fixed on the word "standard" which is just a "marketting"
term, not a real standardization.

Well, if you prefer standard ML syntax, do it! and compile your
programs by:
      ocamlc -pp "camlp4 pa_sml.cmo pr_dump.cmo" -c foo.ml

And why not Scheme syntax:
      ocamlc -pp "camlp4 pa_scheme.cmo pr_dump.cmo" -c foo.ml

> Sometimes SML solution is shorter.

For example?

> Records in ocaml is not optimal. From a record creation, the type
> should be obvious, so labels can be reused in different type of
> records.

That's right: but this difference is not just syntax: it has big
consequences on typing.

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] syntaxes
  2002-10-04  7:40 [Caml-list] syntaxes Kontra, Gergely
  2002-10-04  8:32 ` Daniel de Rauglaudre
@ 2002-10-04  9:22 ` Pierre Weis
  1 sibling, 0 replies; 6+ messages in thread
From: Pierre Weis @ 2002-10-04  9:22 UTC (permalink / raw)
  To: Kontra, Gergely; +Cc: caml-list

Hi,

> I've seen so far, that there are at least 2 version of syntax exists.
> My only question is: why has ocaml different syntax than standard ML at
> the places, where ocaml is not more efficient.
> Eg. it is the same as writing => and ->.
> Sometimes SML solution is shorter.
> Records in ocaml is not optimal. From a record creation, the type should
> be obvious, so labels can be reused in different type of records. And
> there is the let ... in ... end (Ada like) construct, which can be used
> to avoid ambiguity, (My opinion, that it should be used in try ... with
> ... end and match ... end constructs, but forget it, uniform syntax may
> be a more important point...) not talking about pattern matching in
> function heads...
> 
> Gergo
> 
> +-[Kontra, Gergely @ Budapest University of Technology and Economics]-+
> |         Email: kgergely@mcl.hu,  kgergely@turul.eet.bme.hu          |
> |  URL:   turul.eet.bme.hu/~kgergely    Mobile: (+36 20) 356 9656     |
> +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+
> .
> Magyar php mirror es magyar php dokumentacio: http://hu.php.net
> 
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

Read the FAQ:

http://pauillac.inria.fr/caml/FAQ/FAQ_EXPERT-eng.html#sml

The answer to the question

 Why is the syntax of Caml different from SML's one ?

should be relevant to your concern.

Let me know if this is not clear enough for your taste.

Regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] syntaxes
  2002-10-04  8:32 ` Daniel de Rauglaudre
@ 2002-10-04 10:58   ` Kontra, Gergely
  2002-10-04 11:04     ` Daniel de Rauglaudre
  2002-10-07  7:06     ` Pierre Weis
  0 siblings, 2 replies; 6+ messages in thread
From: Kontra, Gergely @ 2002-10-04 10:58 UTC (permalink / raw)
  To: Daniel de Rauglaudre; +Cc: caml-list

>Well, if you prefer standard ML syntax, do it! and compile your
>programs by:
>      ocamlc -pp "camlp4 pa_sml.cmo pr_dump.cmo" -c foo.ml
>
>And why not Scheme syntax:
>      ocamlc -pp "camlp4 pa_scheme.cmo pr_dump.cmo" -c foo.ml

I don't like parens...
What about other syntax files? Are there collected somewhere?


>> Sometimes SML solution is shorter.
>For example?

pattern matching in function head...

Gergo
+-[Kontra, Gergely @ Budapest University of Technology and Economics]-+
|         Email: kgergely@mcl.hu,  kgergely@turul.eet.bme.hu          |
|  URL:   turul.eet.bme.hu/~kgergely    Mobile: (+36 20) 356 9656     |
+-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+
.
Magyar php mirror es magyar php dokumentacio: http://hu.php.net

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] syntaxes
  2002-10-04 10:58   ` Kontra, Gergely
@ 2002-10-04 11:04     ` Daniel de Rauglaudre
  2002-10-07  7:06     ` Pierre Weis
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel de Rauglaudre @ 2002-10-04 11:04 UTC (permalink / raw)
  To: caml-list

Hi,

On Fri, Oct 04, 2002 at 12:58:00PM +0200, Kontra, Gergely wrote:

> What about other syntax files? Are there collected somewhere?

As far as I know there is no other complete syntaxes for OCaml proposed.

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] syntaxes
  2002-10-04 10:58   ` Kontra, Gergely
  2002-10-04 11:04     ` Daniel de Rauglaudre
@ 2002-10-07  7:06     ` Pierre Weis
  1 sibling, 0 replies; 6+ messages in thread
From: Pierre Weis @ 2002-10-07  7:06 UTC (permalink / raw)
  To: Kontra, Gergely; +Cc: daniel.de_rauglaudre, caml-list

> >> Sometimes SML solution is shorter.
> >For example?
> 
> pattern matching in function head...
> 
> Gergo
> +-[Kontra, Gergely @ Budapest University of Technology and Economics]-+
> |         Email: kgergely@mcl.hu,  kgergely@turul.eet.bme.hu          |
> |  URL:   turul.eet.bme.hu/~kgergely    Mobile: (+36 20) 356 9656     |
> +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+

This has been reported many times as such, but:

1) Semantically, this is not as clear as Caml's ``function'' construct.

2) You have to carefully count characters before stating that pattern
matching in function head is shorter! Very often, functions using
pattern matching have many cases, and repeating the function name for
each clause is a burden and a lot more typing.

3) We already had this feature in Caml in the past. When we suppressed
it, nobody complained at the time: I suspect that serious Caml's users
(those that write in the mailing lists to complain and ask for new
features) never used ``pattern matching in function head''.

In my mind ``pattern matching in function head'' is a typical
``programming in the small'' feature: it is useful for beginners
and/or small functions with only 2 or 3 cases but useless for huge
pattern matchings.

Once more Caml has a tendency to favour programming in the large.

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-10-07  7:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-04  7:40 [Caml-list] syntaxes Kontra, Gergely
2002-10-04  8:32 ` Daniel de Rauglaudre
2002-10-04 10:58   ` Kontra, Gergely
2002-10-04 11:04     ` Daniel de Rauglaudre
2002-10-07  7:06     ` Pierre Weis
2002-10-04  9:22 ` Pierre Weis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).