microsoft / microsoft/typespec

Reconsider `Foo<>` means default instance

Open
#1,831 1 comment 0 reactions 0 assignees View on GitHub
design:needed
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

From design discussed here https://github.com/microsoft/typespec/issues/1163. Creating a new issue as that design discussion had 2 part and 1st is still relevant. This is to rediscuss the 2nd part.

It was decided that given a template

```ts
model Template {
x: T
}
```
1. `Template<>` would reference the default instance (`Template`)
2. `Template` would reference the uninstantiated template

The thing is right now `Template` means the default instance already, so this change would not only be a breaking change but I think relatively confusing for spec writers.

https://cadlplayground.z22.web.core.windows.net/?c=bW9kZWwgTTxUID0gc3RyaW5nPiB7CiAgeDogVDsKfQoKYWxpYXMgTURlZmF1bHRJbnN0YW5jZSA9IE07CgrGPkTFMmQxOtEnLng7Cn0%3D

with this issue https://github.com/microsoft/typespec/issues/1774 also now on the table I think we might want to reconsider the augment decorator scenario which is as far as I can tell the only place where we want to reference the uninstantiated template

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.