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

Make compiler throw warnings #11

Closed
VMatthijs opened this issue Dec 12, 2018 · 6 comments
Closed

Make compiler throw warnings #11

VMatthijs opened this issue Dec 12, 2018 · 6 comments
Labels
bug Something isn't working

Comments

@VMatthijs
Copy link
Member

We need to throw warnings for deprecated constructs.

Are there any more that are desired?

@VMatthijs VMatthijs added this to the initial release milestone Dec 12, 2018
@bob-carpenter
Copy link
Contributor

bob-carpenter commented Dec 12, 2018 via email

@VMatthijs
Copy link
Member Author

Thanks, @bob-carpenter !

@VMatthijs VMatthijs added the bug Something isn't working label Dec 12, 2018
@VMatthijs
Copy link
Member Author

VMatthijs commented Jan 11, 2019

@bob-carpenter , @seantalts , I currently have a local solution to this issue. However, it generates quite wordy warnings for a lot of files and I'm not sure what is most desirable. It generates warnings like

Warning: deprecated language construct used at file "wishart2x2.stan", line 51, column 19:
   -------------------------------------------------
    49:    //     | rho * sd2               rho * sd1        sd1 * sd2 * (1 - rho^2)   |
    50:
    51:    increment_log_prob(log(2.0 * sd1)
                            ^
    52:                       + log(2.0 * sd2)
    53:                       + log(sd1 * sd2 * (1.0 - rho * rho)));
   -------------------------------------------------

increment_log_prob(...); is deprecated and will be removed in the future. Use target += ...; instead.

for every use of a deprecated construct in a file. Some files have many deprecated constructs in them, so we get a lot of these warnings. For instance, on the file

model {
   real x;
   x <- 24.2; #wrong
   #again
   increment_log_prob(14.0);
   print(get_lp());
}

we get the warnings

Warning: deprecated language construct used at file "test2.stan", line 3, column 6:
   -------------------------------------------------
     1:  model {
     2:     real x;
     3:     x <- 24.2; #wrong
               ^
     4:     #again
     5:     increment_log_prob(14.0);
   -------------------------------------------------

assignment operator <- is deprecated in the Stan language; use = instead.


Warning: deprecated language construct used at file "test2.stan", line 3, column 14:
   -------------------------------------------------
     1:  model {
     2:     real x;
     3:     x <- 24.2; #wrong
                       ^
     4:     #again
     5:     increment_log_prob(14.0);
   -------------------------------------------------

Comments beginning with # are deprecated. Please use // in place of # for line comments.


Warning: deprecated language construct used at file "test2.stan", line 4, column 3:
   -------------------------------------------------
     2:     real x;
     3:     x <- 24.2; #wrong
     4:     #again
            ^
     5:     increment_log_prob(14.0);
     6:     print(get_lp());
   -------------------------------------------------

Comments beginning with # are deprecated. Please use // in place of # for line comments.


Warning: deprecated language construct used at file "test2.stan", line 5, column 20:
   -------------------------------------------------
     3:     x <- 24.2; #wrong
     4:     #again
     5:     increment_log_prob(14.0);
                             ^
     6:     print(get_lp());
     7:  }
   -------------------------------------------------

increment_log_prob(...); is deprecated and will be removed in the future. Use target += ...; instead.


Warning: deprecated language construct used at file "test2.stan", line 6, column 14:
   -------------------------------------------------
     4:     #again
     5:     increment_log_prob(14.0);
     6:     print(get_lp());
                       ^
     7:  }
   -------------------------------------------------

get_lp() function is deprecated. It will be removed in a future release. Use target() instead.

I could of course make the warnings less verbose or make sure at most one warning gets thrown per file, but that might also make them less useful. What is desirable here in your opinions?

@VMatthijs
Copy link
Member Author

VMatthijs commented Jan 11, 2019

Update: I have now pushed my local implementation with the behaviour described above. If you would prefer a different kind of behaviour, I'm happy to change it!

@bob-carpenter
Copy link
Contributor

bob-carpenter commented Jan 11, 2019 via email

@VMatthijs
Copy link
Member Author

Great! Then, this should be solved. Thanks, @bob-carpenter !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants