Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checked and template generic terminology #2138

Merged
merged 9 commits into from
Sep 10, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions proposals/p2138.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Checked and template generic terminology

<!--
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
-->

[Pull request](https://github.com/carbon-language/carbon-lang/pull/2138)

<!-- toc -->

## Table of contents

- [Abstract](#abstract)
- [Problem](#problem)
- [Proposal](#proposal)
- [Rationale](#rationale)

<!-- tocstop -->

## Abstract

Change terminology from "generics" and "templates" to "checked generics" and
"template generics". Afterwards, "generics" will be an umbrella term that
include templates.

## Problem

The C++ community does "generic programming" using templates in C++, and so
thinks of templates as a mechanism for implementing generics. In Carbon,
templates and other generic features are more similar than they are different,
so it is worthwhile to have an easy way to talk about things that apply to both.

## Proposal

Change terminology from "generics" and "templates" to "checked generics" and
"template generics". Afterwards, "generics" will be an umbrella term that
include templates.
josh11b marked this conversation as resolved.
Show resolved Hide resolved

Some existing design docs give examples of the difference before and after this
proposal:

- The [generics overview](/docs/design/generics/overview.md), for example,
currently demonstrates the current approach of using "generics" and
"templates".
- The
[generics section of the design overview](/docs/design/README.md#generics)
demonstrates the use of the proposed new terminology.

## Rationale

Using the terminology expected by the community supports these goals:
jonmeow marked this conversation as resolved.
Show resolved Hide resolved

- [Code that is easy to read, understand, and write](/docs/project/goals.md#code-that-is-easy-to-read-understand-and-write)
since our documentation governing the interpretation of that code will be
more easily understood and with greater accuracy.
- [Interoperability with and migration from existing C++ code](/docs/project/goals.md#interoperability-with-and-migration-from-existing-c-code)
since there will be a smaller terminology gap between Carbon and C++.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just shifting the terminology gap, because "templates" are now "template generics"? How does this reduce the terminology gap?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the specific improvement is that in C++, people talk about doing generic programming with templates, and with this shift in terminology you can talk about doing generic programming with template [generic]s in Carbon too.

josh11b marked this conversation as resolved.
Show resolved Hide resolved