# Disable subfunction from user who installs package?

**URL:** <https://discourse.julialang.org/t/disable-subfunction-from-user-who-installs-package/23602>\
**Category:** New to Julia\
**Created:** [April 27, 2019, 3:56pm UTC](https://discourse.julialang.org/t/disable-subfunction-from-user-who-installs-package/23602 "2019-04-27T15:56:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [April 27, 2019, 3:56pm UTC](https://discourse.julialang.org/t/disable-subfunction-from-user-who-installs-package/23602/1 "2019-04-27T15:56:54Z")

</div>

Hey guys, so a fairly basic question I assume. I’ve made a package in which there exists two functions:

```julia
readVtk
readVtkArray

```

Where basically readVtkArray is a function which utilizes readVtk. Currently I am only using “export readVtkArray”, so to get to use readVtk, an user has to do; PackageName.readVtk(input) - but is there anyway to make it so that will not even work? So the user can only use the functions I allow?

I know that an user can go and change the source code in the end, and the purpose of doing this is just to avoid the user, using a wrong function.

Kind regards

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [April 27, 2019, 4:12pm UTC](https://discourse.julialang.org/t/disable-subfunction-from-user-who-installs-package/23602/2 "2019-04-27T16:12:32Z")

</div>

No, there is not. Julia, in it’s current form, is focused on making difficult problems easier to solve. It’s not a language focused on stopping people from doing things they shouldn’t.

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [April 27, 2019, 4:28pm UTC](https://discourse.julialang.org/t/disable-subfunction-from-user-who-installs-package/23602/3 "2019-04-27T16:28:43Z")

</div>

Okay bummer, not a huge problem anyways, but would be a quality of life improvement in my case at least.

Thanks for the fast answer!

Kind regards

---

<div class="post-metadata">

**Author:** ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Post date:** [April 27, 2019, 8:41pm UTC](https://discourse.julialang.org/t/disable-subfunction-from-user-who-installs-package/23602/4 "2019-04-27T20:41:20Z")

</div>

In addition to what Robin said, I would like to add that a solution/workaround to such concerns could lie in a good documentation and naming convention. I would say that prefixing/suffixing private names with an underscore (`_`) is a rather well-established convention these days, so that if you name your function `_readVtk`, users of your package should at least get a hint that they’re not supposed to use this function directly. This will be made even more explicit if that naming convention is mentioned in your package documentation.

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [April 27, 2019, 8:43pm UTC](https://discourse.julialang.org/t/disable-subfunction-from-user-who-installs-package/23602/5 "2019-04-27T20:43:19Z")

</div>

That is actually a great idea. I will utilize this from now on, thanks! This way it will not interfere with the way Julia works as @rdeits described earlier.

Kind regards
