Annotating OCaml Variables and Returns with local_ | OCaml Unboxed

  Рет қаралды 1,986

Jane Street

Jane Street

Күн бұрын

This is the second installment in the video series explaining OCaml's locals.
In this video, I explain how we can annotate variables and return types with local_.
Code for this video: github.com/gol...
View instructions to get the compiler I use in this video: github.com/jan...
Playlist for videos in this series: • OCaml Unboxed

Пікірлер: 8
@Metruzanca
@Metruzanca 9 ай бұрын
Would love more of these ocaml unboxed
@JeanNoelAvila
@JeanNoelAvila 10 ай бұрын
Very interesting! Maybe a dumb question: why annotate when the compiler can check whether the variables do not escape their context?
@RichardEisenberg-JS
@RichardEisenberg-JS 10 ай бұрын
By annotating, we can check whether our belief meets reality, turning a mistaken belief into a compile-time error. Annotating also informs future readers of our code and makes the code easier to understand.
@JeanNoelAvila
@JeanNoelAvila 10 ай бұрын
@@RichardEisenberg-JS Thank you. Is the stack allocation not implemented if it is not annotated?
@RichardEisenberg-JS
@RichardEisenberg-JS 10 ай бұрын
@@JeanNoelAvila Inferring stack allocation (not covered in depth in the video, but it will be!) works just fine. You don't need to annotate for that.
@adicide9070
@adicide9070 9 ай бұрын
Do you know if this stuff will be part of the language?
@RichardEisenberg-JS
@RichardEisenberg-JS 9 ай бұрын
I know we will work with the OCaml community maintainers to get this to be a part of the language -- but not for a while. Our approach is to experiment locally (ha ha) here at Jane Street, gain experience about what's good and what's bad, and then to work to upstream when we have more confidence. In the end, language design is hard to get right, and we want to take advantage of the fact that we can somewhat easily undo mistakes before this is all part of the official language.
@adicide9070
@adicide9070 9 ай бұрын
@@RichardEisenberg-JS aaah the puun! :D nice to watch though. not sure if OCaml can get more popular and widely adopted at this point but ML is the bomb, so here's hoping something ML does!
OCaml Locals Save Allocations | OCaml Unboxed
23:25
Jane Street
Рет қаралды 2 М.
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 1,6 МЛН
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 279 М.
What the Heck Are Monads?!
21:08
ArjanCodes
Рет қаралды 74 М.
System Jitter and Where to Find It: A Whack-a-Mole Experience
27:17
I implemented Goto in OCaml
38:41
Tsoding Daily
Рет қаралды 42 М.
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 115 М.
Inferring Locality in OCaml | OCaml Unboxed
22:27
Jane Street
Рет қаралды 1,4 М.
uv: An Extremely Fast Python Package Manager
40:34
Jane Street
Рет қаралды 43 М.
Unboxed Types for OCaml
47:18
Jane Street
Рет қаралды 7 М.
"Clean" Code, Horrible Performance
22:41
Molly Rocket
Рет қаралды 909 М.
Introducing the OCaml Local Mode | OCaml Unboxed
8:53
Jane Street
Рет қаралды 6 М.
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 1,6 МЛН