0
$\begingroup$

Some languages provide maintainable ways to specify the number of "the current line". In C, for example, one can use the __LINE__ macro.

Does Mathematica have anything like that?


EDIT: Of course, this is not to be used in notebooks, but rather in *.m files.

$\endgroup$
  • 2
    $\begingroup$ How do you plan to use such a macro? $\endgroup$ – Shadowray Jul 19 '17 at 12:02
  • $\begingroup$ @Shadowray: it doesn't need to be a macro. I want to use it to facilitate debugging-via-print-statement (I can't afford WR's fancy Workbench). $\endgroup$ – kjo Jul 19 '17 at 12:26
  • 1
    $\begingroup$ @kjo Workbench is now a free plugin for Eclipse. Everyone can afford it. community.wolfram.com/groups/-/m/t/963774 $\endgroup$ – Gustavo Delfino Jul 19 '17 at 12:38
  • $\begingroup$ @GustavoDelfino: Thanks, that's good to know. In the short term, though, I need to debug some stuff now, and would prefer not to have to install & learn Eclipse in order to do it. $\endgroup$ – kjo Jul 19 '17 at 12:40
  • 2
    $\begingroup$ Mathematica has no concept of "lines" in the same way as compiled languages do. See this for an explanation by Leonid. See this for some useful debugging tools. Alternatively use Assert or stack printing to help you figure out what's going on. $\endgroup$ – b3m2a1 Jul 19 '17 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.