Ticket #71 (new enhancement)

Opened 7 years ago

Last modified 4 months ago

Secret translation of .sage to .py causes confusion

Reported by: Justin Walker (justin@… Owned by: cwitty
Priority: minor Milestone: sage-feature
Component: misc Keywords:
Cc: Work issues:
Report Upstream: N/A Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

When a .sage file is "load"ed or "attach"ed, it gets translated to a .py file before being processed; the result is a file with different structure than the original. Any errors are described in terms of the .py file, not the .sage file. I realize this is a kind of Catch-22, but is there a way to (as the C preprocessor does) keep the .sage line numbers?

Of course this requires that Python have that ability, because it reports the errors.

I suppose the proper solution, given this, is to document the issue.

I think this points up an aspect of a fundamental issue: SAGE is a programming language/system; SAGE is a computer system for mathematicians to use. I'm not sure how good it can be at both.

Change History

comment:1 Changed 7 years ago by was

SAGE can embed the original line numbers in the .py file, and even the original .sage lines (before parsing) in the .sage file. Then the error messages will also list the original line number (and line, if you want) in a comment at the end of the line. In the notebook, at least, it would be easy to postparse the error messages so they refer to the original .sage file.

comment:2 Changed 6 years ago by was

  • Type changed from defect to enhancement

This is not a bug.

comment:3 Changed 6 years ago by mabshoff

  • Milestone set to sage-feature

comment:4 Changed 4 years ago by davidloeffler

  • Owner changed from somebody to cwitty
  • Component changed from basic arithmetic to misc

comment:5 Changed 4 years ago by AlexGhitza

  • Summary changed from Secret transation of .sage to .py causes confusion to Secret translation of .sage to .py causes confusion

comment:6 Changed 4 months ago by kcrisman

  • Report Upstream set to N/A

Hi. This is a REALLY old ticket. Is the documentation at the programming tutorial now sufficient, or should we still keep this ticket around? I love the idea in William's (six-year-old) comment:1, so we could repurpose this ticket to implement this if desired. Or, one could just improve the documentation a little to mention that errors refer to lines in the .py file.

Note: See TracTickets for help on using tickets.