Skip to content

cross reference comments via a GUID-like pattern, eg: D20210217T221607 #596

@timotheecour

Description

@timotheecour

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 here

each 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 D20210217T221607 jumps to the place where D20210217T221607:here is 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions