Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

casuarius fork #14

Open
schell opened this issue Aug 26, 2022 · 8 comments
Open

casuarius fork #14

schell opened this issue Aug 26, 2022 · 8 comments

Comments

@schell
Copy link

schell commented Aug 26, 2022

I just wanted to mention here that I've forked this repo to https://github.com/schell/casuarius. Our versions have diverged quite a bit and I don't want to put extra burden on maintaining this original repo. Thanks again for the great implementation :)

@orhun
Copy link

orhun commented Oct 22, 2024

Hello! Is your fork active? Just wondering what kind of improvements you have made over this one :)

@schell
Copy link
Author

schell commented Oct 22, 2024

@orhun It's been a while since I worked on this project (it's technically still active) but I think the biggest change was removing Rc variables to make the system Send + Sync.

@schell
Copy link
Author

schell commented Oct 22, 2024

Here's the diff, @orhun #15 . Can't believe it's already been 6 years!

@orhun
Copy link

orhun commented Oct 23, 2024

Time flies fast!

The reason why I ask is that we use this repo for layout calculations in ratatui - it's quite a crucial part of our codebase. So I was wondering if switching to your fork would bring any benefits. What do you think?

I think the biggest change was removing Rc variables to make the system Send + Sync

Hmm, I need to see if that's going to affect anything. AFAIK we use quite a bit of Rc for our Rect type but let's see.

FWIW, I get the following compiler errors when I try to make the switch to casuarius:

  1. Variable::new() is not found.
  2. no implementation for Variable | WeightedRelation
  3. Constraint, Solver, and Expression expects a generic argument

@schell
Copy link
Author

schell commented Oct 24, 2024

Oh, wow - ratatui is a cool project :) I've used it once and it was fun!

You might get some benefits from my changes - I made them for one of my own projects that I'm no longer working on, but I made them so long ago now that I'm not sure what was involved, though I'll try to answer according to your compilation issues you noted. I'm reading the diff myself, now.

...

As far as Rc is concerned, I think I remember that it wasn't required in the library itself, and it was probably more about how @dylanede was using the library. Since my use case didn't need to mutate variables without having access to the solver, and given that the solver would be sent across threads (I had mine in an ECS) I decided to remove Rc.

I removed Variable in favor of a parameterized variable type on Constraint, Solver and Expression. The idea being that your variable type is domain-specific and would be defined in your own crate.

I then added a macro derive_syntax_for that derives the required traits for using your local variable type in constraint expressions. You can see an example here. I think we'd all be better served to have this macro be a proper derive-macro but I made these edits before I really knew how to do that, lol.

As for WeightedRelation - I think maybe I just ditched that type in favor of specifying inequalities using plain functions. I can't remember the reasoning.

...

Anyway - I hope that helps! I don't really use my fork for anything at the moment so let me know if you want maintainership or a transfer or to make pull requests to change the API (or none of the above, lol), I'm easy.

@schell
Copy link
Author

schell commented Oct 24, 2024

Huh, actually @orhun WeightedRelation is still there.

@orhun
Copy link

orhun commented Oct 24, 2024

Thanks for the throughout explanation on your changes! That really helps clearing out a thing or two :)

What I did for trying out casuarius was just to override the cassowary dependency to see the breaking changes. Next step would be fixing those and seeing if our test suite complains and so on.

Inviting other Ratatui maintainers (@joshka @kdheepak) to the discussion :)

Now, there are some questions to be raised:

  • Do we want to revamp the layout system of Ratatui using casuarius?
  • While we are at it, maybe it is a good opportunity to explore the other layout approaches?

I don't really use my fork for anything at the moment so let me know if you want maintainership or a transfer or to make pull requests to change the API (or none of the above, lol),

Would be nice to do that in the future maybe, thanks :)

@joshka
Copy link

joshka commented Oct 24, 2024

I also took a stab at forking it a little while ago. I took some inspiration from your fork @schell, but went a bit of a different direction so far:
Diff:
joshka/kasuari@90d1df4...main

My changes were:

  • lots of formatting
  • Fixing up errors so they actually are errors
  • moved a bunch of things into different modules
  • updated a few things to rust 2021 idioms
  • lots of clippy changes
  • optimise -> optimize (because 'merica' ;))
  • started adding testing
  • and a few more things I'm sure I'm forgetting

This is unfinished, and mostly just an exploration of cassowary at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants