ponylang / pony-tutorial

:horse: Tutorial for the Pony programming language
http://tutorial.ponylang.io
BSD 2-Clause "Simplified" License
310 stars 111 forks source link

Package documentation should detail trust boundary #491

Open SeanTAllen opened 2 years ago

SeanTAllen commented 2 years ago

Currently the package documentation doesn't discuss how search path resolution is done, nor what that means for a "trust boundary".

Currently ponyc searches for package use "foo" by the following:


It is important to understand the ramifications of search from "base".

base/
  main.pony
  assert/
    assert.pony

You have overriden the standard library "assert" package with your own. You can replace the entire standard library this way if you wanted. Odds are folks don't want to do that, but they can.

The important thing here is that everything you put relative to your base is effectively "part of your application" or "part of your library" and it is "trusted" like your other code. Installing 3rd party code relative to base and referencing it as such makes it indistinguishable from your own code to the library. This has interesting ramifications for allowing or denying FFI usage to packages in addition to overriding parts of the standard library that a power user might want to do.

Detailing base resolution means in terms of a "trust boundary" is important and needs to be detailed along with the package resolution rules.