Hi fediverse,

Which of the following would be the nicest to wrap a low-level 3D geometry (I.e vertices, geometry, topology) operations library written in Rust.

Common Lisp (and which implementation?)

Ideally, I'd like to be able to easily make higher-level operations such as boolean, blend, etc from the low level library and make that as one command in an ergonomic language (with a repl) that allows me to play around easily with various geometrical objects to compose them in increasingly complex ways and then pass the modified object back to the Rust code in case we need to revert a high-level operation operation (this is key). Eventually, a parser would let you pass some math formulae in (Latex?) and execute the live math for you in an interactive way that let's you modify the objects.


[Boosts appreciated]

A big element of this endeavor would be the ability to guarantee valid types only. Meaning, I should not be able to accidentally use the higher level API to create a square with 5 sides, etc. So, whatever constrains are imposed by my primitives remain. If the higher-level language would also let me prove properties about my specific geometrical object after a series of operations that'd be a huge plus (although I have zero knowledge of this domain). For example, if after some operations (unknowingly to the user) they change a mesh in such a way that it now satisfies conditions for a Delaunay triangulation then it would output a message saying this is the case. Alternatively, given some mesh I should be able to specify "make it X" and it would automatically apply the operations (based on a selection of suitable algorithms) on the mesh that would guarantee that the output does indeed satisfy X.

Show thread
@zpartacoos Do “static” languages even have a REPL? I'd think Haskell is out of question if you want a REPL.

@akater yeap, you can do so from GHCi (interactive mode) on the terminal.

@zpartacoos You mean, Haskell compiles REPLs into its output binaries? If not, what does the REPL talk to? If it talks to GHC, how do actions in REPL relate to objects in the running program?
@zpartacoos I can only comment on CL. I never knew if you could call Rust from CL but apparently you can:

SBCL is likely the safest bet if you go with CL. CL has a type system; SBCL may be very strict about types if you want it. What you want from type inference though, seems unrealistic to me despite the fact that I'm ignorant about the matter. You'll almost certainly have to check for specific things like triangulation conditions on your own.

I'm not saying CL will be the best fer you but it offers the most freedom, and people sorta praise its CFFI.

@mc interesting alternative. I'll have to look further into it as I have never used it or heard much about it outside of data science and ML circles. I'm curious, do you know if Julia let's you define custom syntax? So that rather than just call functions in the repl as:

Let c= circle(radius=15)
colorize(c, "red")

Instead I could do:


Or whatever other weird syntax I want.

The reason I'm asking is because from what I understand about the other languages mentioned on thr list, you are able to do this. Meaning that if the syntax used to manipulate the geometric objects turns out to be cumbersome then we'd be able to experiment and make it more intuitive over time without having to touch the low-level Rust code.

@zpartacoos The only thing I can say is that of that list Haskell is the only language I have found enjoyable. But thats more of a general comment than anything to do with your specific needs.

@freemo yeah I only started trying out the others on the list yesterday but Haskell holds a special place in my heart (despite me sucking at it).

@zpartacoos I use SBCL and Rust but I'm working on text processing. I tried to use GNU Guile, Racket, Chicken, Chez Scheme but I found that Common Lisp has libraries I needed. So I switched. Haskell is too difficult for me and I took too much time to learn but still I cannot use it fluently yet. Moreover its string implementations did not impress me. Maybe it is alright for you.
@zpartacoos You'll want to have your Crate export a C API and compile to a shared object, then you can create bindings to each of the higher-level languages using their C FFI functionality.
Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.