Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional debug #24

Merged
merged 14 commits into from
Jul 8, 2020
Merged

Optional debug #24

merged 14 commits into from
Jul 8, 2020

Conversation

sparverius
Copy link
Contributor

adding

  • srcgen/xats/params.hats
    • contents => #define __XATS_DEBUG__ 1
    • included in files where debug information is currently dumped

For example in srcgen/xats/DATS/trans12_envmap.dats

#if(__XATS_DEBUG__)
val () =
println!
("the_dexpenv_add_cst: d2c = ", d2c)
val () =
println!
("the_dexpenv_add_cst: d2cs = ", d2cs)
#endif

Set __XATS_DEBUG__ to 0 to disable the compiler from dumping the debug info via:

#define __XATS_DEBUG__ 0

…ding through output tree (particularly when list is empty)
+ srcgen/xats/params.hats
  + contents => ``` #define __XATS_DEBUG__ 1```
  + included in files where debug information is currently dumped

For example in srcgen/xats/DATS/trans12_envmap.dats
```ats
val () =
println!
("the_dexpenv_add_cst: d2c = ", d2c)
val () =
println!
("the_dexpenv_add_cst: d2cs = ", d2cs)
```

Set `__XATS_DEBUG__` to 0 to disable the compiler from dumping the debug info via:
```ats
```
+ srcgen/xats/params.hats
  + contents => ``` #define __XATS_DEBUG__ 1```
  + included in files where debug information is currently dumped

For example in srcgen/xats/DATS/trans12_envmap.dats
```ats
val () =
println!
("the_dexpenv_add_cst: d2c = ", d2c)
val () =
println!
("the_dexpenv_add_cst: d2cs = ", d2cs)
```

Set `__XATS_DEBUG__` to 0 to disable the compiler from dumping the debug info via:
```ats
```
Copy link
Owner

@githwxi githwxi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will create a file in xats/HATS for this purpose.

I tend to control the output of debugging information incrementally during
a debugging session. I like to gradually uncomment various print-statements
when debugging. When debugging is done, I re-comment these print-statements
out so that they can be used for the next debugging sessions.

It is difficult to rely on ifdef-guards for this style of debugging. However, with ifdef-guards,
it does seem to be easier to ship code. Let me add such guards from time to time.

@githwxi githwxi merged commit 114d2ca into githwxi:master Jul 8, 2020
@githwxi
Copy link
Owner

githwxi commented Jul 9, 2020

Here is a little bit of naming convention I use:

XATS: for general stuff related to ATS/Xanadu

XATSLIB: for the kind of stuff related to the libraries
XATSPRE: for the kind of stuff related to the prelude

XATSOPT: for the kind of stuff related to the compiler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants