Git Product home page Git Product logo

Comments (7)

jacquesg avatar jacquesg commented on June 21, 2024

This seems reasonable, here are my thoughts:

  • Multi-var values should be passed directly on the stack instead of via a list reference.
  • The options controlling the behaviour of set should be the first argument after 'key'.
  • Add an unset method instead of passing undef to set. unset should return the value(s) that was set.
  • I would implement the existing str, int and bool in terms of set and unset.
  • I would define constants for the "type" i.e. type => 'str' would become Git::Raw::Config->STRING

from p5-git-raw.

waterkip avatar waterkip commented on June 21, 2024

I'm not really a fan of putting the options directly after the key. If you wouldn't use the options, you would get something like set('foo', {}, 'value') which doesn't look nice, or undef instead of {}.

from p5-git-raw.

jacquesg avatar jacquesg commented on June 21, 2024

The other way to do it is to make it the (optional) first parameter to set.

from p5-git-raw.

waterkip avatar waterkip commented on June 21, 2024

I am curious about why you want this, it has the same rather inconsistent API. The options are optional and aren't needed per se to set the value. So why they come first is something I do not understand.

from p5-git-raw.

jacquesg avatar jacquesg commented on June 21, 2024

I want any key and values to be adjacent, so that the following works:

my @keyAndValue = ('key', 'value');
$config->set ({options1 => 1}, @keyAndValue);

If the optional options argument slices key and value the above won't work.

from p5-git-raw.

jacquesg avatar jacquesg commented on June 21, 2024

I guess you could also make it work by putting the options last. It actually doesn't matter that much...

from p5-git-raw.

jacquesg avatar jacquesg commented on June 21, 2024

Feel free to make it the last argument.

from p5-git-raw.

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.