juvix icon indicating copy to clipboard operation
juvix copied to clipboard

Avoid breaking changes to `Package.juvix` caused by updates to standard library

Open paulcadman opened this issue 9 months ago • 1 comments

Background

Users can choose to import the Juvix standard library in Package.juvix files. Note that the standard library is not required if you're just declaring a simple package, but there may be uses for it in more complex cases.

Currently the Package.juvix file is resolved in an environment which contains the standard library from the global package.

Issue

  1. It's intended that a user may customise their global package. They could, for example, update the version of the standard library or remove the standard library dependency from the global package completely. This could break package loading.
  2. The version of the standard library is not pinned, so a Package.juvix file that uses a fixed version of the PackageDescription module that also imports Stdlib.Prelude today may not work with future versions of the compiler.

Options

  1. Don't allow standard library imports in a Package.juvix file and restore this feature when we have better use-cases
  2. Add a pinned copy of the standard library under the PackageDescription namespace, i.e in PackageDescription.V3.Stdlib.Prelude. Users would not be able to import Stdlib.Prelude directly.
  3. Something else

paulcadman avatar Apr 29 '24 12:04 paulcadman

I'd say go for option 1 since it is the simplest and is enough for what we need now (and probably what we'll need for a long while). When/if needed, let's do option 2.

janmasrovira avatar Apr 29 '24 12:04 janmasrovira