Comments (8)
Maybe, the ability to run native OCaml as NIF without hassle, and safely?
I was thinking about starting an OCaml equivalent to Rustler... This could be just a third-party library though. But I can see the benefit of bundling it into the standard lib: you can market Caramel to be a faster Erlang in some ways, as the regular developer could more easily make use of NIF while using the same syntax.
from caramel.
I would add a decimal floating point type. Fortunately, there is one for OCaml :-) https://github.com/yawaramin/ocaml-decimal
from caramel.
@yawaramin good thinking! Thankfully Erlang/OTP has baked in bigint support -- how would you have structured your library if OCaml's int was already a big int? 🤔 Anything in particular you'd rework?
edit: I see you're using zarith for bigint stuff, so probably all of that would go away. If you're interested in helping us reuse your lib, it'd be interesting to parametrize it with a bigint implementation, so we can pass in our default Int module, and you can pass in Zarith. Otherwise we'll likely fork ocaml-decimal
into ./stdlib/num/big_decimal.ml
if that's okay with you :)
from caramel.
We may need to parametrize the functor with that too 😂 -- there's no mutable data by default in Erlang/Elixir, but you can build support for it via NIFs (natively-implemented-functions). I have done so before for a few things like memory mapped ring buffers that essentially behave as byte arrays. Performance is better, of course, but I'm yet to compare with OCaml's.
The big problem is that now you have to be aware of all the good ol' concurrency problems, because your process will move across schedulers (cpu threads) without you getting any signals for it.
And this can be the cause of segfaults and other gnarly memory unsafe ops that will take down the entire runtime.
Something to think about. We should experiment a little more!
from caramel.
For debugging purposes, I think having an equivalent of Elixir's IO.puts
and IO.inspect
for generic 'a
types would be neat.
from caramel.
@nicobao i think its a good idea to provide a path forward to writing NIFs in OCaml as well, but we're descoping this for the time being. We can revisit it later on! 🙌🏼
from caramel.
Interesting, @Ostera so Erlang ints can automatically become bigints? Same as Python I guess. Let me look into functorizing it and get back to you. There are a couple of other things that might be tough to port over though, e.g. I am using mutable arrays. Does Caramel allow that?
EDIT: also GADTs
from caramel.
It's unclear from the discussion here whether the intention is to wholesale implement a separate Caramel standard library, with similar functionality as Erlang's - or provide FFI bindings to them.
From playing with Caramel it appears that there's quite a lot missing in the FFI bindings to Erlang standard library functions, which is very understandable for a young project. Would PRs be acceptable to add more and more in, or is there a different intention for the Erlang standard library functions/functionality?
from caramel.
Related Issues (20)
- Fix windows dependencies cache on CI HOT 1
- Annotating types for function arguments compiles to wrong erlang HOT 1
- Nested let-in expressions compile to wrong erlang HOT 12
- Fun references of operators have the wrong arity and module name HOT 2
- Pipe operator support HOT 4
- Make it clear to see what's different from the standard OCaml lang+runtime HOT 1
- Add a hello world snippet in the frontpage HOT 1
- Make it clear we need Erlang installed
- Idiomatic Elixir wrappers for generated code
- Unclear behavior with externals HOT 1
- Mention caramel parse command in CONTRIBUTING.md
- Support aliases in patterns
- The sources of the following couldn't be obtained, aborting: - erlang.0.0.14
- Generate unique variable names to deal with name shadowing and Erlang bindings escaping expression blocks HOT 2
- Map Literal syntax HOT 2
- Atom/Variant which is just underscore is a Syntax Error HOT 2
- Are parameterized modules/functors available? HOT 3
- Wrong Compiler Version in Release 0.1.1 HOT 1
- Function declarations with explicit type annotations compile to the wrong Erlang code HOT 8
- build with latest ocaml 4.14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from caramel.