# Includes

**URL:** <https://discourse.mc-stan.org/t/includes/1040>\
**Category:** Developers\
**Tags:** bugs\
**Created:** [June 24, 2017, 9:53pm UTC](https://discourse.mc-stan.org/t/includes/1040 "2017-06-24T21:53:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [June 24, 2017, 9:53pm UTC](https://discourse.mc-stan.org/t/includes/1040/1 "2017-06-24T21:53:25Z")

</div>

How are the interfaces supposed to use includes in 2.16?

I have `bar.stan`

```
parameters {
  #include baz.stan
}
model {
  target += normal_lpdf(theta | 0, 1);
}

```

and `baz.stan`

```
real theta;

```

And I pass the path of `baz.stan` to `compile` and get

```
paths[0] =
/tmp/SU/
SYNTAX ERROR, MESSAGE(S) FROM PARSER:

Warning (non-fatal): Comments beginning with # are deprecated. Please use // in place of # for line comments.
variable "theta" does not exist.
  error in 'model421549a41e60_bar' at line 5, column 30
  -------------------------------------------------
     3: }
     4: model {
     5: target += normal_lpdf(theta | 0, 1);
                                     ^
  -------------------------------------------------

```

It looks as if it is treating `#include baz.stan` as a comment?!?

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [June 24, 2017, 9:56pm UTC](https://discourse.mc-stan.org/t/includes/1040/2 "2017-06-24T21:56:02Z")

</div>

> [@bgoodri](#):
>
> It looks as if it is treating #include baz.stan as a comment?!?

Upon further review, it works if the `#include` statement is flush left. Is that an intended restriction? If so, WTF and it seems to be inconsistent with the manual which says “There are no restrictions on where include statements may be placed within a file …”

---

<div class="post-metadata">

**Author:** ![Bob\_Carpenter](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bob_carpenter/32/9230_2.png) [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Post date:** [July 17, 2017, 11:06pm UTC](https://discourse.mc-stan.org/t/includes/1040/3 "2017-07-17T23:06:06Z")

</div>

Yes, WTF.

I meant to implement it flush left, then I thought you wanted it not flush left, then I think I did implement it flush left, but I documented as general.

How should we fix this? I’d rather leave it all flush left, but could be convinced to generalize. It needs an issue to change the behavior (not hard) or a comment in the next manual issue to change the doc.

This really shouldn’t have even been in the manual until people could use it.

---

<div class="post-metadata">

**Author:** ![betanalpha](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/betanalpha/32/4_2.png) [@betanalpha](https://discourse.mc-stan.org/u/betanalpha)\
**Post date:** [July 18, 2017, 3:11am UTC](https://discourse.mc-stan.org/t/includes/1040/4 "2017-07-18T03:11:21Z")

</div>

I vote arbitrary whitespace before the include given that one might want to include into an existing block, typically the functions block, and maintain the expected whitespace.

---

<div class="post-metadata">

**Author:** ![Bob\_Carpenter](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bob_carpenter/32/9230_2.png) [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Post date:** [July 19, 2017, 9:59pm UTC](https://discourse.mc-stan.org/t/includes/1040/5 "2017-07-19T21:59:13Z")

</div>

I think that’s what everyone wants. So I added an issue:

[https://github.com/stan-dev/stan/issues/2358](https://github.com/stan-dev/stan/issues/2358)

Only question is whether we include the space up to the `#` on the line?

---

<div class="post-metadata">

**Author:** ![jonah](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jonah/32/200_2.png) [@jonah](https://discourse.mc-stan.org/u/jonah)\
**Post date:** [July 19, 2017, 10:22pm UTC](https://discourse.mc-stan.org/t/includes/1040/6 "2017-07-19T22:22:47Z")

</div>

> [@Bob\_Carpenter](#):
>
> I think that’s what everyone wants. So I added an issue:
> 
> [allow space before # in includes · Issue #2358 · stan-dev/stan · GitHub](https://github.com/stan-dev/stan/issues/2358)
> 
> Only question is whether we include the space up to the `#` on the line?

Cool. I think it would be preferable not to include the space up to the `#`, but I don’t feel strongly about it.
