Giter VIP home page Giter VIP logo

Comments (3)

MichaelHatherly avatar MichaelHatherly commented on August 25, 2024 2

I would recommend that for SIGNATURES, missing argument names (eg _) just print their type if it is different from Any. But that may not work for everyone and it could be that we need a new abbrev.

Agreed, that seems like reasonable behaviour.

Incidentally, maybe we could have customizable abbrevs? Eg Signatures(; kwargs...).

Yes, kind of setup already do be able to do something like that if we want to allow customisation. It's just not really been needed til now. So you interpolate a $(MethodSignatures(; type_unnamed_args = true)) in your docstrings instead of the default one. (Name of option TBD).

struct MethodSignatures <: Abbreviation end
"""
An [`Abbreviation`](@ref) for including a simplified representation of all the method
signatures that match the given docstring. See [`printmethod`](@ref) for details on
the simplifications that are applied.
# Examples
The generated markdown text will look similar to the following example where a function `f`
defines method taking two positional arguments, `x` and `y`, and two keywords, `a` and the `b`.
````markdown
```julia
f(x, y; a, b...)
```
````
"""
const SIGNATURES = MethodSignatures()

from docstringextensions.jl.

MichaelHatherly avatar MichaelHatherly commented on August 25, 2024

What is the recommended approach to deal with this?

I hadn't put any thought into that particular case, so perhaps there isn't a recommended approach yet. Others feel free to chime in if you've needed this kind of thing.

(Using TYPEDSIGNATURES just gives a docstring without the signature, but maybe that is a separate issue)

If that was resolved to print something out would it go some ways to solving the case for you?

from docstringextensions.jl.

tpapp avatar tpapp commented on August 25, 2024

Yes and no. In a lot of cases resolving that would help me. Eg

"""
$(TYPEDSIGNATURES)
"""
foo(x, ::Val{N}) where N= nothing

does precisely what I want, but I could imagine typing x but not wanting to print that type.

I would recommend that for SIGNATURES, missing argument names (eg _) just print their type if it is different from Any. But that may not work for everyone and it could be that we need a new abbrev.

Incidentally, maybe we could have customizable abbrevs? Eg Signatures(; kwargs...).

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.