JuliaDocs / JuliaDocs/DocStringExtensions.jl

include defaults for Base.@kwdef structs in FIELDS (or something else)

Open
#182 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
126
Forks
35
PR merge metrics
No merged PRs in 30d

Description

In a struct that was defined with Base.@kwdef, is it possible to generate a docstring similar to what FIELDS currently does, but with defaults? MWE:

using DocStringExtensions

"""
$(FIELDS)
"""
Base.@kwdef struct Foo
    a::Int = 1
end

should show something like

  • a = 1

I am not even sure if this is conceptually possible though, or if there is a reasonable workaround. Related: #19.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing FIELDS implementation and investigating how Base.@kwdef represents field defaults during docstring generation. Determine whether those defaults are accessible, then verify the MWE can produce a field entry such as - a = 1, or document a reasonable workaround if it cannot.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.