You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ability to modify/infer types from other types is a key feature of generic programming. It is proposed that the langauge add support to programmitcally create types from comptime TypeInfo structs with the @infoType function, i.e.
@infoType is the inverse of the @typeInfo function and it's signature would be:
@infoType(comptimeinfo: @import("builtin").TypeInfo) type
The following comment describes how this feature can be used to implement the SliceType and ArrayPointerType functions which take an array/pointer type and return either the slice or array pointer variation of it while preserving the const/volatile/allowzero properties:
The point being that without programmatic generation of types, the code requires 2^N cases to return a type where N is the number of properties for that type (i.e. const/volatile/allowzero). See the comment in the above link for further clarification.
The text was updated successfully, but these errors were encountered:
The ability to modify/infer types from other types is a key feature of generic programming. It is proposed that the langauge add support to programmitcally create types from
comptime TypeInfo
structs with the@infoType
function, i.e.@infoType
is the inverse of the@typeInfo
function and it's signature would be:The following comment describes how this feature can be used to implement the
SliceType
andArrayPointerType
functions which take an array/pointer type and return either the slice or array pointer variation of it while preserving the const/volatile/allowzero properties:#2782 (comment)
The point being that without programmatic generation of types, the code requires
2^N
cases to return a type whereN
is the number of properties for that type (i.e.const
/volatile
/allowzero
). See the comment in the above link for further clarification.The text was updated successfully, but these errors were encountered: