Learning Julia by an example of a simple Bayesian linear regression

Now onto some of your specific questions:

Usually this denotes iteration, and you’re fine. Anything that shows up blue in @code_warntype is not a cause for worry. If you want an output that more closely matches your source code (instead of the low level representation that is harder to decipher), check out GitHub - JuliaDebug/Cthulhu.jl: The slow descent into madness. A bit scary at first but remarkably easy to get a handle on. Basically a @code_warntype on steroids with arbitrary depth.

You also have to take into account clarity here. Separate functions are usually a good thing… up to a point. Not sure what that one-liner is, but there are many situations where sigma = rand(Normal(0, 1)) would be clearer that sigma = draw_sigma() (dumb example). So if it doesn’t affect your code speed, you shouldn’t always bother.

What do you mean by “inherit”? You already put using LinearAlgebra in your NewB module, and if you need it in your main file then put it there again. The module is designed to be reusable by someone else, who may not import LinearAlgebra in their main file after all.