Skip to content

Commit

Permalink
package scope -> file scope
Browse files Browse the repository at this point in the history
imports are typically in the file scope, they don't become part of the package
  • Loading branch information
danakj committed Jan 20, 2025
1 parent cd3c784 commit 8d90337
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions proposals/p4682.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ We propose to add `Core.Array(T, N)` as a library type in the `prelude` library
of the `Core` package. Since arrays are a very frequent type, we propose to
privilege use of this type by providing a builtin `Array(T, N)` type that
resolves to the `Core.Array(T, N)` type. Users can model this as an implicit
import of the `Core.Array(T, N)` type into the package scope, much like the
import of the `Core.Array(T, N)` type into the file scope, much like the
implicit import of the `prelude` library of the `Core` package.

## Problem
Expand Down Expand Up @@ -279,8 +279,8 @@ library type, it is mostly focused on the goal
This proposal aims to make code easy to understand by having the builtin
forwarding name match exactly with the type in the `Core` library. This choice
makes the builtin conceptually equivalent to an implicit `import` of the type
into the package scope, much like the implicit `import` of the `prelude` library
of the `Core` package, something developers will already need to model in their
into the file scope, much like the implicit `import` of the `prelude` library of
the `Core` package, something developers will already need to model in their
minds when reading Carbon code. That `Array` will be provided as a compiler
builtin is an implementation detail that the Carbon developer need not worry
about. It could as easily be implemented as an implicit `import`.
Expand Down Expand Up @@ -366,7 +366,7 @@ Providing just the library type is possible, but arrays will be one of the most
common types in Carbon code, as described earlier. Privileging them with a
shorthand that avoids `Core.` will help make Carbon code significantly more
concise, due to the frequency, without hurting understandability. This makes it
worth the tradeoff of putting a name into the package scope (by way of a builtin
worth the tradeoff of putting a name into the file scope (by way of a builtin
type).

### `array(T, N)`
Expand Down

0 comments on commit 8d90337

Please sign in to comment.