Live data from Hacker News

OxCaml - a set of extensions to the OCaml programming language.

oxcaml.org

41–50 of 128 posts

Re: OxCaml - a set of extensions to the OCaml programming language.

#41

The first feature that originated in this fork to be upstreamed is labeled tuples, which will be in OCaml 5.4: https://github.com/ocaml/ocaml/pull/13498 https://discuss.ocaml.org/t/first-alpha-release-of-ocaml-5-4...

> Because sum:int * product:int is a different type from product:int * sum:int, the use of a labeled tuple in this example prevents us from accidentally returning the pair in the wrong order, or mixing up the order of the initial values. Hmm, I think I like F#'s anonymous records better than this. For example, {| product = 6; sum = 5 |}. The order of the fields doesn't matter, since the value is not a tuple.

Isn't that just the same as the ordinary OCaml { product = 6; sum = 5 } (with a very slightly different syntax)?

Re: OxCaml - a set of extensions to the OCaml programming language.

#42
post #9

The first feature that originated in this fork to be upstreamed is labeled tuples, which will be in OCaml 5.4: https://github.com/ocaml/ocaml/pull/13498 https://discuss.ocaml.org/t/first-alpha-release-of-ocaml-5-4...

Anonymous labeled structs and enums are some of my top wished-for features in programming languages! For instance, in Rust you can define labelled and unlabelled (i.e. tuple) structs struct Foo(i32, i32); struct Bar{sum: i32, product: i32} But you can only e.g. return from functions an anonymous tuple, not an anonymous labelled struct fn can() -> (i32, i32) fn cant() -> {sum: i32, product: i32}

In Dart, we merged tuples and records into a single construct. A record can have positional fields, named fields, or both. A record type can appear anywhere a type annotation is allowed. So in Dart these are both fine:

    (int, int) can() => (1, 2);
    ({int sum, int product}) alsoCan() => (sum: 1, product: 2);
    (int, {int remainder}) evenThis() => (1, remainder: 2);
The curly braces in the record type annotation distinguish the named fields from the positional ones. I don't love the syntax, but it's consistent with function parameter lists where the curly braces delimit the named parameters.

https://dart.dev/language/records

Re: OxCaml - a set of extensions to the OCaml programming language.

#43
post #38

Earlier quoted context omitted.

Is that really a viable solution for a timeframe of 6+ hours?

Sure, if you know how much you allocate per minute (and don’t exceed your budget) you just buy enough RAM and it’s fine.

(this comment was off topic, sorry)

Re: OxCaml - a set of extensions to the OCaml programming language.

#44
post #3

So this is "oxidized" because it tries to achieve the same features as Rust (e.g. "fearless concurrency" is mentioned, and avoiding GC)... Not because it actually uses Rust in any way right? Slightly confusing.

It's ironic of course because Rust (the language) is named after the fungus called Rust, rather than iron-oxide

Re: OxCaml - a set of extensions to the OCaml programming language.

#45
post #41

Earlier quoted context omitted.

> Because sum:int * product:int is a different type from product:int * sum:int, the use of a labeled tuple in this example prevents us from accidentally returning the pair in the wrong order, or mixing up the order of the initial values. Hmm, I think I like F#'s anonymous records better than this. For example, {| product = 6; sum = 5 |}. The order of the fields doesn't matter, since the value is not a tuple.

Isn't that just the same as the ordinary OCaml { product = 6; sum = 5 } (with a very slightly different syntax)?

The difference between { … } and {| … |} is that the latter’s type is anonymous, so it doesn’t have to be declared ahead of time.

Re: OxCaml - a set of extensions to the OCaml programming language.

#47
post #43
post #38

Earlier quoted context omitted.

Sure, if you know how much you allocate per minute (and don’t exceed your budget) you just buy enough RAM and it’s fine.

(this comment was off topic, sorry)

Is this relevant to OCaml?

Re: OxCaml - a set of extensions to the OCaml programming language.

#48

Earlier quoted context omitted.

Yeah, this would be great! Currently only 128-bit SSE/NEON is working but AVX is coming very soon. There's also nothing blocking Windows, but it will require some work. (I added the SIMD support in OxCaml)

Cool to hear there aren't any technical blockers to add Windows support! You just convinced me into giving OxCaml a try for a hobby project. 128-bit SSE is likely to be enough for my use case and target specs.

David Allsopp had an oxcaml branch compiling on Windows a few months ago, so it’s in the queue…

Re: OxCaml - a set of extensions to the OCaml programming language.

#50
post #38

Earlier quoted context omitted.

Is that really a viable solution for a timeframe of 6+ hours?

Sure, if you know how much you allocate per minute (and don’t exceed your budget) you just buy enough RAM and it’s fine.

This will decrease performance because of reduced locality. Maybe increased jitter because of TLB misses.
Post reply on HN