forked from nim-lang/Nim
-
Notifications
You must be signed in to change notification settings - Fork 0
cross reference comments via a GUID-like pattern, eg: D20210217T221607 #596
Copy link
Copy link
Open
Description
I've been using the following pattern for a while now, it greatly simplifies writing cross-referencing explanations or links.
example
whenever we need to cross reference an explanation, we can use this pattern:
the explanation goes in 1 place, with a GUID-like pattern suffixed with :here:
# D20210217T221607:here explanation goes hereeach time we need to reference the explanation, we can then just use:
# see D20210217T221607
and likewise each time we need to refer to that explanation:
# see D20210217T221607
benefit
- DRY: avoids repeating an explanation in several places, so we don't need to sync those
- unique and immutable: the GUID-like pattern is (for all practical purposes) guaranteed to be unique, and easily recognizable so users won't change the pattern once it's generated; whereas if a label was used instead, it'd be more likely to be changed, thus breaking the cross-referencing
- machine & human friendly: the fixed pattern used is easily recognizable and can be exploited by tooling, for example a jump to definition which given
D20210217T221607jumps to the place whereD20210217T221607:hereis defined - the GUID-like pattern can be generated by tooling (I can share the nim or python code that generates these based on current time)
links
datestring2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels