summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/design/casting.md4
-rw-r--r--docs/design/decl-refs.md4
2 files changed, 5 insertions, 3 deletions
diff --git a/docs/design/casting.md b/docs/design/casting.md
index 522e1d707..6c4b119eb 100644
--- a/docs/design/casting.md
+++ b/docs/design/casting.md
@@ -7,7 +7,7 @@ C++'s built in mechanisms for casting (principally dynamic_cast) is problematic
* There are types which we want to 'dynamic_cast' that do not have, and we do not want to have a Vtbl (for example Slang::IRInst).
* There are types which a 'dynamic_cast' doesn't do quite what we want (for example casting on Type* derived types typically wants to work on their canonical type)
-* We may want to replace use of dynamic_cast in the future for speed/space or other reasons in the future
+* We may want to replace use of dynamic_cast in the future for speed/space or other reasons
* It is common in the code base when using a 'smart pointer' type to cast it, but still return a smart pointer
To deal with these issues we need casting within Slang to follow it's own methodology. In summary it is as follows...
@@ -18,6 +18,8 @@ To deal with these issues we need casting within Slang to follow it's own method
* If you want to *literally* do a dynamic cast use 'dynamicCast' free function.
* This guarantees the returned pointer points to the same object (like normal dynamic_cast)
* If you want to return a smart pointer from a cast from a smart pointer use the .as or .dynamicCast *methods*
+* If you want to determine if an 'as' cast is possible on a smart pointer use the .is method
+ * Doing so will produce more efficient code because a new smart pointer does not need to be constructed
These functions will also work with types that do not have Vtbl - like IRInst derived types.
diff --git a/docs/design/decl-refs.md b/docs/design/decl-refs.md
index 1644f6f34..3a84cfdcf 100644
--- a/docs/design/decl-refs.md
+++ b/docs/design/decl-refs.md
@@ -69,7 +69,7 @@ If we then want to query the type of this field, we can first look up the type s
Cell::T [Cell::T => int]
```
-Of course, we can then simplify the reference by applying the substutions, to get:
+Of course, we can then simplify the reference by applying the substitutions, to get:
```
int
@@ -89,7 +89,7 @@ Each ancestor of a declaration can introduce an expected substitution along the
* A surrounding `interface` declaration usually requires a `ThisTypeSubstitution` that identifies the specific type on which an interface member has been looked up.
-All of the expected substitutions should be in place in the gerneral case, even when we might not have additional information. E.g., within a generic declaration like this:
+All of the expected substitutions should be in place in the general case, even when we might not have additional information. E.g., within a generic declaration like this:
```hlsl
struct Cell<T>