         guard let record = knownRecordReference else {
             return argumentTypeName
         }
+        let typeName = optionalIfNullableOrOptional(templateName(for: record))
+        return typeName
+    }
+
+    /// return the swift (known) type of the receiver when passed as an argument
+    /// Returns a reference name in case of a known record with a default value
+    @inlinable
+    var defaultRefTemplateTypeName: String {
+        guard let record = knownRecordReference else {
+            return argumentTypeName
+        }
+        let templateName: String
+        if allowNone {
+            templateName = record.structNamePrefixedIfNecessary
+        } else {
+            templateName = self.templateName(for: record)
+        }
+        let typeName = optionalIfNullableOrOptional(templateName)
+        return typeName
+    }
+
+    /// Return the name of a templated type correspondingg to a given record
+    /// - Note this gets prefixed if the record is in a different namespace
+    /// - Parameter record: A record for which to create a template name
+    /// - Returns: A string representing a template type for the given record
+    @inlinable
+    func templateName(for record: GIR.Record) -> String {
         let className = record.className
         let prefix = typeRef.type.dottedPrefix
         let normalisedPrefix = prefix.asNormalisedPrefix

    /// swift class name for this record
    @inlinable
    var className: String { return swift }
}

    }

    /// return the swift (known) type of the receiver when passed as an argument
    /// Returns a struct `Ref` name in case of a known record
    /// - Note this gets prefixed if the record is in a different namespace
    @inlinable
    var knownRecordStructName: String {
        guard let record = knownRecordReference else {
            return argumentTypeName
        }
        let typeName = record.structNamePrefixedIfNecessary
        return typeName
    }

    /// return the swift (known) type of the receiver when passed as an argument
    /// Returns a(n optional, if nullable) struct `Ref` name in case of a known record
    /// - Note this gets prefixed if the record is in a different namespace
    @inlinable
    var knownRecordArgumentTypeName: String {
        guard let record = knownRecordReference else {
            return argumentTypeName
        }
        let typeName = optionalIfNullableOrOptional(record.structNamePrefixedIfNecessary)
        return typeName
    }

    /// return the swift (known) type of the receiver when passed as an argument
    /// for a `@convention(c)` callback
    @inlinable
    var callbackArgumentTypeName: String {
