No separate compilation
All the code for a contract must be in one
Michelson is a monomorphic language. So is SCaml.
Polymorphic value defitions are rejeted by SCaml. If your values have too general types, you make them have monomorphic types adding type constraints:
For example, the following let definition is rejected in SCaml,
since its type is
let os =  in ...
$ scamlc xxx.ml File "xxx.ml", line X, characters X-X: Error: [ESCaml100] This expression has type 'a list, whose type variable 'a is not supported in SCaml.
You have to add a type constraint to restrict the type variable:
let os : operation list =  in ...
Michelson does not have an opcode for recursion.
Therefore SCaml does not support recursive definitions either:
let rec bindings are rejected.
Still there are still some recursions are available:
SCamlprovides mappings and foldings of list, set, map, and big maps, such as
SCamlalso provides a simple looping:
It might be possible to encode recursion in SCaml using Michelson's closure creation
and serializers (
Obj.unpack), but it should be very gas inefficient.
Do it at your own risk.
No recursive type definitions
SCaml does not support user defined recursive types, because neither does Michelson.
type t = ... can define variants (sums) and records
but they must be non recursive.
Primitive types have some recursion:
Modules, functors, and first class modules are not supported.
No labeled functions
Labeled functions and optional arguments are not supported.
No partial applicatons of primitives
Primitives defined in module
SCaml must be applied fully.
No side effects
No reference, mutable record fields, arrays. No I/O.
SCaml.assert fail contract executions immediately.
There is no way to catch these failures.
No polymorphic variants
Types of polymorphic variants often contain generalized type variables, which make them hard to use in SCaml, a monomorphic language: type constraints should be required everywhere around them.
You can use the normal variants without complications.
No classes nor objects
Object oriented features are not supported. SCaml is not SOCaml nor OSCaml.