From 5d1d0c686dea93de896f40facce644ca5ca07b7b Mon Sep 17 00:00:00 2001 From: Carsten Neumann Date: Wed, 26 Nov 2025 16:50:22 -0500 Subject: [PATCH 1/2] Fixes typo --- docs/understanding-generics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/understanding-generics.md b/docs/understanding-generics.md index fe4dcc1b..2f218522 100644 --- a/docs/understanding-generics.md +++ b/docs/understanding-generics.md @@ -298,7 +298,7 @@ Benefits of Slang's approach: what methods are valid for generic types, unlike C++ template parameters. There are certain things which work with C++ style templates, which are -(deliberatly) disallowed with Slang generics. For example the following code +(deliberately) disallowed with Slang generics. For example the following code will work in C++ but the naïve equivalent in Slang will not compile. ```cpp From ed87afa6841dd6c2e60ff312eeaea6ee49ea8163 Mon Sep 17 00:00:00 2001 From: Carsten Neumann Date: Wed, 26 Nov 2025 16:50:35 -0500 Subject: [PATCH 2/2] Fixes invalid C++ code --- docs/understanding-generics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/understanding-generics.md b/docs/understanding-generics.md index 2f218522..cc254e0a 100644 --- a/docs/understanding-generics.md +++ b/docs/understanding-generics.md @@ -304,8 +304,8 @@ will work in C++ but the naïve equivalent in Slang will not compile. ```cpp // This function will compile when instantiated at a type which supports the + // operator. However this restriction is only discovered at the call site. -template -float addValue(T v0, T v1) { return v0.x + v1.x; } +template +float addValue(T v0, T v1) { return v0 + v1; } // We happen to call `addValue` with a type that supports addition. void user() {addValue(1,2); }