Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
OCaml
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Features== OCaml features a [[Semantic analysis (computer science)|static]] [[type system]], [[type inference]], [[parametric polymorphism]], [[tail recursion]], [[pattern matching]], first class lexical [[Closure (computer science)|closures]], [[Function object#Other meanings|functors (parametric modules)]], [[exception handling]], [[effect system|effect handling]], and incremental generational [[garbage collection (computer science)|automatic garbage collection]]. OCaml is notable for extending ML-style type inference to an object system in a general-purpose language. This permits [[structural subtyping]], where object types are compatible if their method signatures are compatible, regardless of their declared [[Inheritance (object-oriented programming)|inheritance]] (an unusual feature in statically typed languages). A [[foreign function interface]] for [[Linker (computing)|linking]] to [[C (programming language)|C]] primitives is provided, including language support for efficient numerical [[Array data structure|arrays]] in formats compatible with both C and [[Fortran]]. OCaml also supports creating libraries of OCaml functions that can be linked to a ''main'' program in C, so that an OCaml library can be distributed to C programmers who have no knowledge or installation of OCaml. Although OCaml does not have a macro system as an indivisible part of the language ([[metaprogramming]]), i.e. built-in support for [[Preprocessor|preprocessing]], the [https://ocaml.org/docs/metaprogramming OCaml platform does officially support a library for writing such preprocessors]. These can be of two types: one that works at the source code level (as in C), and one that works on the [[Abstract syntax tree|Abstract Syntax Tree]] level. The latter, which is called PPX, acronym for Pre-Processor eXtension, is the recommended one. The OCaml distribution contains: * [[Lexical analysis]] and [[parsing]] tools called ''ocamllex'' and ''ocamlyacc'' * [[Debugger]] that supports stepping backwards to investigate errors * [[Documentation generator]] * [[Profiler (computer science)|Profiler]] β to measure performance * Many general-purpose [[Library (computing)|libraries]] The native code compiler is available for many platforms, including [[Unix]], [[Microsoft Windows]], and [[Apple Inc.|Apple]] [[macOS]]. Portability is achieved through native [[code generation (compiler)|code generation]] support for major architectures: * [[X86-64]] (AMD64), [[RISC-V]], and [[ARM64]] (in OCaml 5.0.0 and higher)<ref>{{cite web|url=https://github.com/ocaml/ocaml/tree/trunk/asmcomp|title=ocaml/asmcomp at trunk Β· ocaml/ocaml Β· GitHub|work=GitHub|access-date=2 May 2015}}</ref> * [[IBM Z]] (before OCaml 5.0.0, and back in OCaml 5.1.0) * [[Power ISA|Power]] (before OCaml 5.0.0, and due to reappear in OCaml 5.2.0) * [[IA-32]] and [[ARM architecture|ARM]] (before OCaml 5.0.0) * [[SPARC]] (before OCaml 4.06.0) * [[DEC Alpha]], [[HPPA]], [[IA64]] and [[MIPS architecture|MIPS]] (before OCaml 4.00.0) The [[bytecode]] [[compiler]] supports operation on any 32- or 64-bit architecture when native code generation is not available, requiring only a C compiler. OCaml bytecode and native code programs can be written in a [[Thread (computer science)|multithreaded]] style, with [[Preemption (computing)|preemptive]] context switching. OCaml [[Thread (computing)|threads]] in the same domain<ref>A domain is a unit of parallelism in OCaml, a domain usually corresponds to a CPU core</ref> execute by [[Time-sharing|time sharing]] only. However, an OCaml program can contain several domains.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
OCaml
(section)
Add topic