Code Monkey home page Code Monkey logo

Comments (10)

z3dev avatar z3dev commented on June 2, 2024

Does this include refactoring the math objects?
I think that should happen first, which would include some movement of functionality, API changes, and splitting out utilities.
Probably not so large, but important for making changes in higher level functions.

from csg.js.

kaosat-dev avatar kaosat-dev commented on June 2, 2024

To be honest I consider it all in the same basket at this stage, so that also includes all the maths and stuff
not going to split up the split up :) at least for now I do not see things clearly enough, and untangling all the dependencies is going to be painful.

from csg.js.

z3dev avatar z3dev commented on June 2, 2024

I guess then it all depends on what the goal is at the end. There haven't been any improvements in performance, so there's lots of low hanging fruit. At this point, I still think that major API changes would be unwelcome. But maybe that would be a natural consequence of the cleanup.

from csg.js.

kaosat-dev avatar kaosat-dev commented on June 2, 2024

Hmm there is a bit of misunderstanding then, I thought we agreed on doing breaking changes at this point, in order to finally clean up the api ?

from csg.js.

z3dev avatar z3dev commented on June 2, 2024

Definitely some things have to change due to the new functional approach.

So, first question...

Is there any point at keeping the old API. For example, circle() becomes a function. Does CAG.circle() continue to exist? I think not but let me know otherwise.

from csg.js.

kaosat-dev avatar kaosat-dev commented on June 2, 2024
  • For a while we can continue to alias functions/objects when possible: even our recent changes have already changed the internals (if you take a look here , it is a LOT of aliases https://github.com/jscad/csg.js/blob/master/csg.js)
  • I do not even know where I got this bad impression / habbit from but a LOT of the 'shapes api' in CSG.js should not be used with a new CSG.X() syntax at all : ie new CSG.cube() is wrong, it should be just const myBox = CSG.cube() (they are not constructors!): ie a lot of stuff is already just functions

About Merging csg.js and scad-api

  • even if the code is messy , scad-api is a very clearly defined API : all of the functions in it are the API, unlike in CSG.js where the difference between internal code and user facing API is very muddy

  • I can read the tests and know the different parameters used and get an API outline real fast

  • with a bit of cleanup it looks way better and clearer (see my recent PR : https://github.com/jscad/scad-api/pull/29/files#diff-6967034af8884bc0784a38ac5706e6d1R248)

  • CSG.js and scad-api are very closely related, and if we want to seperate core features from modeling/helpers, then there is little to no difference between the 'modelling/helpers' code as API and scad-api:

    • so we stop calling it scad-api , it becomes just the functional modeling part of our API
    • it will still be sufficiently similar to openscad syntax to ease the transition, no matter what
    • but we fix any coherency issues with it , even if that means breaking changes
    • we also merge together the 'identical parts' (between CSG & scad-api), retaining some of the different syntax from CSG.js when applicable : ie we want to end up with a single cube() function that is versatile, a single circle() function etc
    • whenever possible/applicable: any code in scad-api that is just a wrapper around CSG features (like extrude) becomes a single piece of code
    • we still want to keep the essence of an API though: ie : the API needs to be somewhat decoupled from the core : ie even IF someone would create a totally different CSG.js from scratch that is better, we should be able to keep our modeling API intact (interface !== implementation)
  • we would end up possibly with 2 'sub packages' core and API, perhaps subpackages like IO is a good fit, I am not 100% sure of this yet

from csg.js.

kaosat-dev avatar kaosat-dev commented on June 2, 2024

hmm rereading some of my points I have some doubts : ie we really want to avoid coupling the core and API too closely

from csg.js.

z3dev avatar z3dev commented on June 2, 2024

All good points above. Thanks for taking the time to outline the changes.

There are a few functions that will come from the CSG library as well, such as expand(), contract(), etc. I presume that these will be retained as part of the API.

Yeah. We ovbously want the core library very tight. So the question about an API library/ project becomes interesting. Maybe after seeing the core, the API will be cleaner and clear.

from csg.js.

z3dev avatar z3dev commented on June 2, 2024

Should be pure functional approach going forward.
const obj = CSG.circle()

Which brings up a few questions...

  • there's over lap between JCSAD API and SCAD API

    • can/should both be used in JSCAD scripts?
    • should the SCAD API be discarded? Merge everything to JSCAD API.
  • this makes core really small, I.e those classs that need the new operator

    • does everything else make sense as either API or UTILS?

from csg.js.

kaosat-dev avatar kaosat-dev commented on June 2, 2024

done by #87 , closing

from csg.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.