Re: beginning with ML



On Nov 6, 4:27 am, Jon Harrop <use...@xxxxxxxxxxxxxx> wrote:

OCaml is also a far more powerful language though. Here's a list of some
really useful features added by OCaml:

. Pattern guards
. Or-patterns
. Lazy stream parsing
. Macros
. Polymorphic variants
. OOP
. Labelled and optional arguments
. Private types
. Ad-hoc polymorphic printing (printf)
. Array literals
. Can export infix operator definitions from modules
. Capitalized type constructors
. Module hierarchy can be reflected in source directory structure
. Conventional unary minus
. Extensive currying in the stdlib
. Mutable record fields
. Structural types
. Recursive types
. Higher-order functors
. "open" allowed in signatures
. Standard integrated build tool
. Portability of a substantial subset to .NET thanks to F#
. Lightweight and efficient FFI with auto codegen
. Lots of documentation
. More libraries than SML
. Wider use in industry
. API browser and IDEs with type throwback
. High-performance interactive mode
. Actively developed
. Polymorphic structural equality, comparison and hashing

While I won't argue your overall conclusion, I have to take issue with
that list. Many points apply to given SML implementaions as well. Some
are weird, e.g. "structural types", which certainly aren't exclusive
to OCaml, and arguably even less pervasive there (cf. records).
Suggesting that SML implementations are not "actively developed" and
generally don't have "high-performance interactive modes" sounds like
active FUD to me (note that - unlike OCaml - SML/NJ or Poly/ML even
compile to native code interactively).

SML adds a few features not in OCaml:

. Equality types
. Single notion of equality
. First-class type constructors
. User defined precedence and associativity of new infix operators
. Ad-hoc polymorphic arithmetic operations
. Immutable strings
. Anonymous record types

I would add quite a few:

- fully specified evaluation order
- uniform numeric types (esp. syntax for infinite precision ints)
- overflow checking for integers (vs. wrap-around word types)
- first-class tuple and record selectors
- datatype replication
- transparent signature ascription
- type ascriptions for polymorphic definitions
- orthogonal design
- fewer syntax gotchas
- formal definition
- machine-verified proof of soundness for complete language
- many implementations, with interesting extensions
- more textbooks

Just to balance your apparent bias...

- Andreas

.



Relevant Pages

  • Re: beginning with ML
    ... Many points apply to given SML implementaions as well. ... are weird, e.g. "structural types", which certainly aren't exclusive ... to OCaml, and arguably even less pervasive there. ... SML has nothing like structurally-subtyped objects and polymorphic variants. ...
    (comp.lang.functional)
  • Re: beginning with ML
    ... are weird, e.g. "structural types", which certainly aren't exclusive ... to OCaml, and arguably even less pervasive there. ... SML has nothing like structurally-subtyped objects and polymorphic variants. ... statement about OCaml not supporting interactive compilation to native code ...
    (comp.lang.functional)