TypeFunction example: ImplictConvTargets
Stefan Koch
uplink.coder at googlemail.com
Mon Oct 5 12:32:06 UTC 2020
On Monday, 5 October 2020 at 11:58:55 UTC, Stefan Koch wrote:
> On Monday, 5 October 2020 at 11:52:06 UTC, rikki cattermole
> wrote:
>> On 06/10/2020 12:44 AM, Stefan Koch wrote:
>>> I leave it up to you to decide which version is more
>>> understandable and extendable (should we ever get another
>>> basic type :))
>>
>> You forgot ucent and cent ;)
>
> You can't write those without making dmd error out.
> And complain about ucent and cent not being implemented.
> At least that used to be the case.
>
> I also didn't write the floating types since, there's still a
> bug in the type function implementation that prevents those
> being turned into type expressions.
Yep ... it's still a problem.
test_alias_implconv.d(9): Error: cent and ucent types not
implemented
test_alias_implconv.d(13): called from here: isBasicType(T)
test_alias_implconv.d(47): called from here:
convTargets(cast(alias)(long))
test_alias_implconv.d(47): called from here:
isEqual(convTargets(cast(alias)(long)),
makeAliasArray([cast(alias)(ulong), cast(alias)(long)][]))
test_alias_implconv.d(47): while evaluating: static
assert(isEqual(convTargets(cast(alias)(long)),
makeAliasArray([cast(alias)(ulong), cast(alias)(long)][])))
This shows another advantage of type functions.
You get a call stack ;)
More information about the Digitalmars-d
mailing list