Arc Forumnew | comments | leaders | submitlogin
2 points by aw 5158 days ago | link | parent

Why do you want to create a private function that can be called from "foo" but is hidden from everything else?


1 point by Pauan 5158 days ago | link

The function might have some internal state, like variables or helper functions. I don't want those to clutter up the namespace, nor do I want them to be mucked up by other code.

-----

1 point by rocketnia 5158 days ago | link

I used to have top-level (let ...) forms here and there for exactly the reasons you described, but sooner or later I regretted not being able to view those values at the REPL during debugging. For instance, Lathe's 'multival-cache* [1] is an implementation detail for the multival framework (which I won't go into here), but it turns out to be really useful to inspect when the framework goes awry.

In any case, I welcome the ability for people to muck with my code, 'cause it's a good way to experiment with making it better. ^_^ Just because something's exposed doesn't mean it's part of a stable API, especially in Arc where things are assumed unstable by default.

Cluttering up the namespace is still an issue, but the obvious advice is to choose unique names. ;) If you're still very worried about it, like I am, I humbly suggest you look at Lathe's namespace system.

[1] I made 'multival-cache* global at https://github.com/rocketnia/lathe/commit/f411a3848275de8510....

-----

1 point by Pauan 5158 days ago | link

Alright, thanks. I'll keep that in mind.

-----