mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 06:21:04 +01:00
Instead of treating `Core.Int` as the toolchain's builtin `IntType`, model it as a class that adapts the builtin type. This aligns us better with the intended language model, gives an associated library for `impl`s involving `Core.Int` to live within, and opens the door adding member functions to `Core.Int` if we decide that is desirable. Remarkably it also seems to make the formatted SemIR a little smaller, because a call to a generic class generates less IR than a call to a function.
15 lines
408 B
Plaintext
15 lines
408 B
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
package Core library "prelude/operators/as";
|
|
|
|
interface As(Dest:! type) {
|
|
fn Convert[self: Self]() -> Dest;
|
|
}
|
|
|
|
interface ImplicitAs(Dest:! type) {
|
|
// TODO: extend As(Dest);
|
|
fn Convert[self: Self]() -> Dest;
|
|
}
|