-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a spec document template #504
Comments
Short summary of the more or less status quo. More or less because it is not consistently used over all documents:
---
title: <MODULE_NAME>
---
# The `<MODULE_NAME>` module
[TOC]
## Introduction
## <OPTIONAL_SECTIONS>
## Procedures and methods provided
### `<PROCEDURE_NAME>` - <SHORT_DESCRIPTION>
### `<PROCEDURE_NAME>` - <SHORT_DESCRIPTION>
#### Status
[<STABLE>, <EXPERIMENTAL>]
#### Description
#### Syntax
#### Class
[<IMPURE>, <PURE>, <ELEMENTAL>,]
#### Arguments
#### Result Value
#### Example |
Should Class be:
? |
@milancurcic I think that would be usefull, even though there is the section The Fortran Std or GCC Style:
|
How about we add 2 small sections in documentation with the name Also, sometimes Fortan throws bad errors, so the documentation can provide some possible ways in which a user can solve those errors. It will be like a small stackoverflow in itself. Also, at places where a feature is quite large people divide documentation as per the use case like |
Also, a contributor might not be aware of markdown which GitHub uses this too can be added. in GitHub Flavoured Markdown: Different websites support different markdown but mostly there is consensus. These websites can help: |
I'd like to simplify and condense the spec as much as possible so the user doesn't have to scroll down a lot to get the full picture. What do you all think about having a "Signature" section? For example for
IMO there are a few advantages to this approach:
Then of course we have a question of how to represent signatures of generic procedures. For
Where curly braces include all compatible types. Or, just spell out all specific signatures. Doing so for all type kinds would probably be overkill and flood the spec page, so perhaps we can simply have a sentence at the bottom of the signature section, saying something like:
If you like this idea, let me know and I can prepare an alternative spec doc for one procedure so we can compare them side by side. |
@milancurcic Yes, to me this sounds like an improvement. |
@milancurcic : I agree. Especially about the generic routines. Your idea could be further extended. Instead of a text describing the function linspace(start, end) result(res)
{real( {sp, dp, qp} ), integer( {int8, int16} ), intent(in) :: start
real( {sp, dp, qp} ), intent(in) :: end
real :: res(DEFAULT_LINSPACE_LENGTH) Negative effect would be of course that the |
I put together a proposal template that could be used as a mold for all spec docs: https://github.com/milancurcic/stdlib-spec-template, with a few changes from the current specs, as described in this thread:
To illustrate, I made an example spec following the proposed template. Compare it with the current version that we have. Rationale on removing "Status" from the spec pages: While everything in stdlib is experimental, and it will be for the foreseeable future, we should simply state upfront in the README.md that everything is experimental, and unclutter the spec docs with unnecessary boilerplate. When we are ready to mark some procedures as stable, we should create a Status page where all the modules, procedures, and derived types will be listed with their statuses. But until then, having every single procedure spell out Status: Experimental on it doesn't communicate anything useful. In summary, my motivation for this is to:
|
Thank you all for this work. The first specs were based on the document of the Fortran standard. The "class" section is required in the Fortran Standard, because the interface is not fully provided (e.g., for Also, I am not sure it is a good idea to list all kinds of
|
Thanks, @jvdp1. Regarding the class, in the first para of your post, are you suggesting that we keep it or merely explaining why we have it? I understand that the first specs followed the standard format. I suggest that we actually not follow the standard, but start from scratch and come up with a format that's most clear to us and conveys the info we need. Regarding the type kinds, I agree with your points, but it seems to me like an argument to not do something useful because it's not perfect. Is there some way that we can indicate that not all kinds may be available on the user's system? This could be a sentence in the README or the docs top-level page a-la:
I think it's quite important that we document the type kinds because some functions have both arguments that use both all kinds and only default kind (for example linspace and logspace accept integers of all kinds for start and end, but only default integer for the number of elements n). A user that attempts to pass an unsupported kind argument will simply get a "could not resolve generic interface" kind of error message, and will need to look in the source code to find out what's wrong. I also recommend that we use plain English and do away with the standardese "shall be" and similar. |
I was trying to explain why we had the
If we mention something like that, then stdlib should support all possible kinds, which is far to be the case now. Also, if I am right, there are only 2 reals defined by the standard: Alternatively, when the issue of data mining
The description of the interface would then be simplified.
I understand this issue. Would something like
I agree with this comment. |
Okay, let's discuss the syntax in a concrete example. For function linspace(start, end, n) result(res)
{integer{int8, int16, int32, int64}, real{sp, dp, qp}, complex{sp, dp, qp}}, intent(in) :: start, end
integer, intent(in) :: n
{real{sp, dp, qp}, complex{sp, dp, qp}} :: res(n) If I understand it correctly, you propose: function linspace(start, end, n) result(res)
{integer(), real(), complex()}, intent(in) :: start, end
integer, intent(in) :: n
{real(), complex()} :: res(n) It's cleaner but to me it looks a lot like function calls. What do you think about this: function linspace(start, end, n) result(res)
{integer(*), real(*), complex(*)}, intent(in) :: start, end
integer, intent(in) :: n
{real(*), complex(*)} :: res(n) Because |
I agree with you: |
@JHenneberg is this syntax acceptable to you? If yes, and if there's no opposition, the next steps would be to:
|
@milancurcic Seems reasonable. |
I update #517 , but I do not really like that there are three SPEC_*.md document on the top level, but creating an extra folder oder pushing the content in one file also does not sound right. Any ideas? |
I am not sure to understand what you mean with "three SPEC_*.md" |
@jvdp1 |
We discussed this on the call today. There is support for the general idea and direction. Takeaways:
Course of action: Implement a template for the current specification format, in other words, don't introduce changes yet. When we have a template, we can revisit and see if and what changes are needed. |
Currently we don't have a Markdown template for spec documents. We should have one. Benefits include:
This could be in a file SPEC_TEMPLATE.md or similar, placed in the root directory, and linked to from WORKFLOW.md and CONTRIBUTING.md.
Inspired by @JHenneberg in #503.
The text was updated successfully, but these errors were encountered: