Git Product home page Git Product logo

Comments (6)

keith avatar keith commented on August 25, 2024 2

The second line is shorter, and definitely more consistent with try map.from. We'll think about doing this in the future. Thanks for the input!

from mapper.

keith avatar keith commented on August 25, 2024

Fair point. I prefer the decreased amount of syntax with .optionalFrom over try? map.from("foo") but that's just a personal preference. If you'd like to use try? everywhere that seems totally reasonable! 😄

from mapper.

osrl avatar osrl commented on August 25, 2024
foo = map.optionalFrom("foo")
foo = try? map.from("foo")
bar = try  map.from("bar")

I think second line is shorter :) And looks more consistent with the third.
Just a suggestion: Since Swift has a dedicated syntax for this and fixed the memory leak on 2.2.1, I would remove the optionalFrom(field: String) and rename optionalFrom(fields: [String]) to something more explanatory like findFrom(fields:[String]) (or a better one).

from mapper.

osrl avatar osrl commented on August 25, 2024

I think this issue might be open again.

from mapper.

Noobish1 avatar Noobish1 commented on August 25, 2024

@osrl have a look at #83, it provides the explanation as to why optionalFrom exists.

from mapper.

keith avatar keith commented on August 25, 2024

If we had the operator precedence mentioned in #83 we would totally remove optionalFrom

from mapper.

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.