[Prev][Next][Index]
Re: Problems with SgStatement::copy()
- From: "Beata Winnicka" <bfatyga@slab.cica.indiana.edu>
- Date: Tue, 9 Aug 94 16:32:38 -0500
- To: Diego Novillo <diego@cs.ualberta.ca>
- Subject: Re: Problems with SgStatement::copy()
- Cc: sage-bugs@cica.indiana.edu
Sage provides methods for retrieving and setting line numbers:
int SgStatement::lineNumber()
and:
void SgStatement::setlineNumber(int n)
The SgStatement::copy() does not copy the line numbers (and in my opinion it should not, because
often when a statement is copied, the line number information does not apply to the newly created
statement). However, you can easily get the line number of the original statement and then use
setlineNumber to set the line number of the copy.
Something along the lines of:
st->setlineNumber(r_st->lineNumber());
using your notation.
Myself, I would not modify the low_level.c code to do that. You'll end up with a version of Sage that differs in
subtle ways from the one that we distribute - as we modify the whole system, we are trying to assure that the
Sage++ methods preserve their functionality, but no such guarantees are made about the "low level" code
(in particular, all the code in low_level.c). For example, one day we might decide to implement the
SgStatement::copy() method in a different way -perhaps not using the duplicateStmts function. Modifying "low
level" code on your own can lead to a maintenance nightmare in the future (if you try to keep your own
version "in sync" with our version) --Beata