Code Monkey home page Code Monkey logo

Comments (8)

stevengj avatar stevengj commented on August 23, 2024

The convention is that constructors should be named like the types. The lower-case versions, like int(...), are things that are (a) more coercive in conversions (no InexactErrors) and (b) may not return the corresponding type. e.g. int([1.0, 3.7]) works and returns an array of integers. See also JuliaLang/julia#1470.

So, in keeping with this convention, you should keep the constructors as uppercase, i.e. Slider(...) and not slider(...). Hence, my vote is to revert this patch.

from interact.jl.

stevengj avatar stevengj commented on August 23, 2024

On the other hand, a function like widget(foo) which automatically constructs a slider for a range foo and a checkbox for a boolean foo, as discussed as #11, should be lowercase, since widget returns some arbitrary subtype of Widget.

from interact.jl.

shashi avatar shashi commented on August 23, 2024

see #16...

from interact.jl.

stevengj avatar stevengj commented on August 23, 2024

I don't see how #16 is related to this. I'm just saying you should revert the case-change patch and make the Checkbox constructor checkbox, to follow Julia conventions.

How you store widget options has nothing to do with whether you capitalize the constructor.

from interact.jl.

shashi avatar shashi commented on August 23, 2024

The proposal in #16 eliminates the need for various widget types like Slider, Checkbox, instead replaced by InputWidget{:Slider}, InputWidget{:Checkbox} and so on, since they all will have the same two fields: options, signal. If I revert the patch now, and later go for a design such as #16, we are going to have to break existing notebooks which use Slider and Checkbox...

from interact.jl.

shashi avatar shashi commented on August 23, 2024

@stevengj Oh, slider and checkbox will still be constructors in that they consrtuct InputWidgets so the convention is Slider and Checkbox? Will revert this if so.

from interact.jl.

stevengj avatar stevengj commented on August 23, 2024

Oh, I see. Yes, I suppose lower-case versions make sense then. But then why do you need slider and checkbox at all if you have widget(x; options) to construct various types of InputWidget?

from interact.jl.

shashi avatar shashi commented on August 23, 2024

slider for example provides default values for some of the arguments like value=median(range).

from interact.jl.

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.