Skip to content
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

Representing module with constants #369

Open
DifferentialOrange opened this issue Jan 13, 2022 · 2 comments
Open

Representing module with constants #369

DifferentialOrange opened this issue Jan 13, 2022 · 2 comments

Comments

@DifferentialOrange
Copy link

DifferentialOrange commented Jan 13, 2022

I have a simple module

return {
    CONST1 = 'value1',
    CONST2 = 'value2',
}

and I need to describe what CONST1 and CONST2 fields store and how they should be interpreted.

I understand that it is possible to write ldoc if my module was like that:

local const = {
    CONST1 = 'value1',
    CONST2 = 'value2',
}

return {
   const = const,
   -- something else
}

but I don't see any ways to describe a string (or number) field in module itself (similar to @function and @table).

DifferentialOrange added a commit to tarantool/crud that referenced this issue Jan 13, 2022
Follows PR review.

Use ldoc aliases for types and [opt] for optional parameters. Fix
typos and outdated info in descriptions. Fix incorrect description
of argument table fields. Use @Local for local functions. Wrap
language constructions in backticks.

It is not clear how to describe modules with constants for ldoc.
ldoc-styled description for `crud.stats.operation` is available
at `crud.stats.module`. See [1] for possible updates.

1. lunarmodules/ldoc#369

Follows up #224
@alerque
Copy link
Member

alerque commented Jan 17, 2022

See Inferring more from code. I would expect this work somehting like

-- @field CONST1 foo bar
-- @field CONST2 baz qiz
local const = {
    CONST1 = 'value1',
    CONST2 = 'value2',
}

return const

Does that not do what you expect?

@DifferentialOrange
Copy link
Author

See Inferring more from code. I would expect this work somehting like

-- @field CONST1 foo bar
-- @field CONST2 baz qiz
local const = {
    CONST1 = 'value1',
    CONST2 = 'value2',
}

return const

Does that not do what you expect?

Yes, page is empty if I try this. If I mix @table, page is empty too.
image

I use ldoc vs 1.4.6 and Tarantool 2.10.0-beta2-0-g9d80b68b9 as a lua interpreter.

DifferentialOrange added a commit to tarantool/crud that referenced this issue Jan 18, 2022
Follows PR review.

Use ldoc aliases for types and [opt] for optional parameters. Fix
typos and outdated info in descriptions. Fix incorrect description
of argument table fields. Use @Local for local functions. Wrap
language constructions in backticks.

It is not clear how to describe modules with constants for ldoc.
ldoc-styled description for `crud.stats.operation` is available
at `crud.stats.module`. See [1] for possible updates.

1. lunarmodules/ldoc#369

Follows up #224
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants