What type functions mean on a language level
Stefan Koch
uplink.coder at googlemail.com
Sat Jan 2 09:13:42 UTC 2021
On Saturday, 2 January 2021 at 08:31:26 UTC, Jacob Carlborg wrote:
> On 2021-01-02 00:26, Stefan Koch wrote:
>
>> Specification wise type functions require two statements to be
>> added.
>>
>> "Under certain conditions a type may be implicitly converted
>> to a value of type __type__."
>> and
>> "Under certain conditions a value of type __type__ may be
>> converted to a type."
>
> "certain conditions" is not suitable for a specification. You
> need to specify all conditions, all details.
>
>> That's it.
>
> You need to specify what __type__ is as well. A keyword? A
> special symbol like __FILE__?
Condition for type -> type value :
you need to use a type in a place where a type value is needed.
Conditions for type value -> type :
- you need to use a type value in place where a type is needed
AND
- the type value needs to be a constant expression.
correct __type__ is a basic type just like int, and therefore a
keyword.
the reason for the four underscores it that __type is already
used in the glibc binding.
More information about the Digitalmars-d
mailing list