Giter Site home page Giter Site logo

Comments (5)

nical avatar nical commented on June 2, 2024 1

Looks like we are on the same page. Just wanted to enumerate options and test the water before writing all the code.

from euclid.

nical avatar nical commented on June 2, 2024

cc @kvark

from euclid.

kvark avatar kvark commented on June 2, 2024

This would mean the question of &self vs self would not impact the user

If we consider the scope of the issue to be larger than self, i.e. when do we pass by value versus by reference, than this will still impact the users.

from euclid.

nical avatar nical commented on June 2, 2024

Sorry my phrasing was a bit clumsy. I do think we should keep the current rule about what we pass by ref and by value for non-self parameters. I believe it works well and changing it would require updating so much code that we'd want a really strong motivation. So I'm referring only to the self parameter.

What I meant was that for non-copyable types it matters a great deal whether or not the methods consumes self, whereas if every vector is Copy no matter what, &self vs self is still a breaking change but not something that would limit or increase the expressiveness of the API or make much of a difference in how the API is used (I think).

from euclid.

kvark avatar kvark commented on June 2, 2024

I'd prefer the API to just be consistent with regards to references. We shouldn't make an exception for self.
Otherwise, what would your guideline be? "if it's less than 16 bytes, pass by value, unless it's self parameter, and type doesn't implement Copy, and a lot of user code doesn't want to clone"?
Can we just say that all the types that our guideline requires to be passed by value would implement Copy. That would mean we are never in a situation where the user needs to do something.clone().foo(...).

from euclid.

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.