Skip to content

add compile-time "reflection" to the Label interface #479

Description

@cpurdy

Is your feature request related to a problem? Please describe.
No. Not a problem, per se. A missing capability, though: Compile-time knowledge of the source code location that can be useful for cut & paste error logging, etc.

Describe the solution you'd like
Add useful properties to the Label interface:

  • @RO String sourceFile; - the name of the source file containing the label
  • @RO Path sourcePath; - the path to the source file, relative to the directory containing the root of the compilation unit (i.e. typically the module file location)
  • @RO String name; - the label name
  • @RO Int lineNumber; - the 0-based (or should it be 1-based???) line number within the file where the label is located
  • @RO Int lineOffset; - the 0-based (or should it be 1-based???) offset within the line where the label is located

Describe alternatives you've considered

  • C macro style: __FILE__ and __LINE__
  • take an exception and get its stack trace

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions