Giter VIP home page Giter VIP logo

Comments (5)

MichaelHatherly avatar MichaelHatherly commented on June 24, 2024 1

My main question is if I made a function that edits the source code (which I'm already 90% done with), would it be considered as an addition to this package? I also have a preference for explicit over implicit/magic, in general.

Feel free to create a PR if you're already that far along implementing and we can weigh up the pros/cons of the approach with something concrete.

Requirements for inclusion in the package would be zero-dependencies outside of Base and general enough to handle any valid Julia syntax that can be documented.

from docstringextensions.jl.

andyDoucette avatar andyDoucette commented on June 24, 2024 1

from docstringextensions.jl.

andyDoucette avatar andyDoucette commented on June 24, 2024

On second thought, with how normal it is for julia devs to work in the repl, maybe I can skip the CLI and it just becomes a function people can access from within julia? Same functionality, just a different interface. Also saves an unnecessary dependency.

from docstringextensions.jl.

MichaelHatherly avatar MichaelHatherly commented on June 24, 2024

On second thought, with how normal it is for julia devs to work in the repl, maybe I can skip the CLI and it just becomes a function people can access from within julia? Same functionality, just a different interface. Also saves an unnecessary dependency.

Yes, just a function-based interface is what would be more useful. (A separate CLI could always be added, but given the precompilation time required in many cases with dev'd packages I doubt many people would use it.)

Another approach that may work better than actually editing the source in that way could be an @autodoc macro that users can just place at the end of their module definition which checks for undocumented bindings and creates an auto-generated docstring for each. A very draft version of how you could go about doing it:

function autodoc(mod::Module)
    docs = Docs.meta(mod)
    for name in names(mod; all = true)
        if isdefined(mod, name)
            binding = Docs.Binding(mod, name)
            if !haskey(docs, binding)
                @eval mod begin
                    @doc """

                    *auto-generated docs*

                    """ $name
                end
            end
        end
    end
end

macro autodoc()
    :(autodoc(@__MODULE__))
end

Has the benefit of not needing the user to run code that changes their source code directly, only an @autodoc call is added to the end of their module.

from docstringextensions.jl.

andyDoucette avatar andyDoucette commented on June 24, 2024

Very interesting approach! Impressive. Being new to julia, I skipped the section on macros, so I have no idea how this works. The whole macro thing seemed like way too much magic for me anyway, but maybe after a few months I'll see the light.

My main question is if I made a function that edits the source code (which I'm already 90% done with), would it be considered as an addition to this package? I also have a preference for explicit over implicit/magic, in general.

from docstringextensions.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.