OCaml

63 readers
1 users here now

A community for the OCaml programming language https://ocaml.org

Looking for mods, if you want to mod the community feel free to dm Ategon

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 10 months ago
MODERATORS
1
3
OCaml Weekly News, 03 Sep 2024 (alan.petitepomme.net)
submitted 2 months ago by mac to c/ocaml
2
 
 

There is more to Hindley-Milner type inference than the Algorithm W. In 1988, Didier Rémy was looking to speed up the type inference in Caml and discovered an elegant method of type generalization. Not only it is fast, avoiding scanning the type environment. It smoothly extends to catching of locally-declared types about to escape, to type-checking of universals and existentials, and even to MLF.

Alas, both the algorithm and its implementation in the OCaml type checker are little known and little documented. This page is to explain and popularize Rémy's algorithm, and to decipher a part of the OCaml type checker. The page also aims to preserve the history of Rémy's algorithm.

Read How OCaml type checker works

3
5
OCaml Weekly News, 23 Jul 2024 (alan.petitepomme.net)
submitted 4 months ago by mac to c/ocaml
4
 
 

Jun 28, 2024

Matt Walker writes:

This is an extremely early stage of development, but basically at this point it is possible to:

  • Call any builtin Godot utility function or method (static, virtual, or otherwise) from OCaml easily, and with documentation comments for the original function intact an available through your favourite OCaml LSP implementation.
  • Use Godot (binary) operators in a natural way from OCaml. (Unary operators are currently broken, which I will be investigating!)
  • Construct Godot values from OCaml easily, and from OCaml analogues if they exist (e.g. I incur a dependency on Gg for low-dimensional vector math)
  • Marshalling in and out of all these functions to/from the OCaml analogues. That is, a method that is in Godot on an object of type ClassyClass taking an int parameter and returning an int will appear in Godotcaml as int64 -> ClassyClass.t structure ptr -> int64, where the ClassyClass.t structure ptr is the “pointer to the Godot object”, commonly called self. (Note that this is always the last argument, to facilitate pipeline-style programming when GDScript programmers have a method-chaining interface.)
  • Naturally define a new Godot class in OCaml that inherits from an existing Godot-registered class. (Currently NOT tested with classes defined in GDScript and/or externally.)
  • Most of the code-gen for custom engines that define new stock/builtin types and classes, etc.
  • Simulated inheritence for stock (and easily extendable to user-defined) classes using module inclusion: That is if Derived inherits from Base, then simply include Base in the module representing Derived, and you get access to all the methods from Base without explicit casting (or in the case of Rust’s gdext, object composition).
  • Naturally define a new Godot method in OCaml and have it called from GDScript or another Godot-bound language. (ergonomics still WIP).

Read Announcing Godotcaml for Godot 4.2

See also: Setting Up a Godotcaml Project (Today)

5
8
OCaml Weekly News, 09 Jul 2024 (alan.petitepomme.net)
submitted 4 months ago by mac to c/ocaml
6
1
OCaml Weekly News, 02 Jul 2024 (alan.petitepomme.net)
submitted 4 months ago by mac to c/ocaml
7
7
OCaml Weekly News, 07 May 2024 (alan.petitepomme.net)
submitted 6 months ago by mac to c/ocaml
8
3
OCaml Weekly News, 09 Apr 2024 (alan.petitepomme.net)
submitted 7 months ago by mac to c/ocaml
9
3
OCaml Weekly News, 02 Apr 2024 (alan.petitepomme.net)
submitted 7 months ago by mac to c/ocaml
10
4
OCaml Weekly News, 26 Mar 2024 (alan.petitepomme.net)
submitted 8 months ago by mac to c/ocaml
11
12
2
OCaml Weekly News, 19 Mar 2024 (alan.petitepomme.net)
submitted 8 months ago by mac to c/ocaml
13
3
OCaml Weekly News, 12 Mar 2024 (alan.petitepomme.net)
submitted 8 months ago by mac to c/ocaml
14
9
OCaml Weekly News, 05 Mar 2024 (alan.petitepomme.net)
submitted 8 months ago by mac to c/ocaml
15
 
 

I had been meaning to try OCaml for a long time, and saw the opportunity.

My daughter's school schedule was sent in an inconvenient format (screenshot), so I decided to type it in manually in sexps, which I am a fan of.

These are used as a source for my program to generate icalendar with recurrences, exceptions for the holidays, and so on. Someone might find it useful as reference too.

16
8
OCaml Weekly News, 27 Feb 2024 (alan.petitepomme.net)
submitted 8 months ago by mac to c/ocaml
17
5
OCaml Weekly News, 20 Feb 2024 (alan.petitepomme.net)
submitted 9 months ago by mac to c/ocaml
18
3
OCaml Weekly News, 13 Feb 2024 (alan.petitepomme.net)
submitted 9 months ago by mac to c/ocaml
19
20
6
OCaml Weekly News, 06 Feb 2024 (alan.petitepomme.net)
submitted 9 months ago by mac to c/ocaml
21
3
OCaml Weekly News, 30 Jan 2024 (alan.petitepomme.net)
submitted 9 months ago by mac to c/ocaml
22
5
OCaml Weekly News, 23 Jan 2024 (alan.petitepomme.net)
submitted 10 months ago by mac to c/ocaml
23
24
4
OCaml Weekly News, 16 Jan 2024 (alan.petitepomme.net)
submitted 10 months ago by mac to c/ocaml