View mode: basic / threaded / horizontal-split · Log in · Help
February 10, 2012
Re: GoingNative 2012 to be livestreamed tomorrow - part 2
On 02/11/2012 12:27 AM, bearophile wrote:
> Timon Gehr:
>
>> __ctfeWriteln is not required (it is not a declaration, therefore it
>> probably won't work).
>
> Then IsNumberWithError needs to be compile-time function.
>

I'm not sure what you are saying here.

>
>> pragma(msg, ...) can already be used for that purpose.
>
> I don't like pragma(msg), it even forces a newline at the end.
>

So does __ctfeWriteln.

> Bye,
> bearophile
February 11, 2012
Re: GoingNative 2012 to be livestreamed tomorrow - part 2
Timon Gehr:

> I'm not sure what you are saying here.

I meant using something like this, instead of a template:

bool IsNumberWithError(T, string file=__FILE__, int line=__LINE__)() {
     enum bool result = is( ...
     if (!result)
         __ctfeWriteln(file, "(", line, "): '", typeid(T), "' is not a number.");
   return result;
}


> So does __ctfeWriteln.

I know, but I hope __ctfeWriteln will become __ctfeWrite or someone will write a __ctfeWrite too. See the pull request for discussions about this. Having no way to avoid the ending newline is awful, it forces me to build large strings with appends and print them all at once instead of using just a series or writes. Not having an ending newline was my first requirement for an acceptable compile-time printing function.

Bye,
bearophile
February 11, 2012
Re: GoingNative 2012 to be livestreamed tomorrow - part 2
On 02/11/2012 01:47 AM, bearophile wrote:
> Timon Gehr:
>
>> I'm not sure what you are saying here.
>
> I meant using something like this, instead of a template:
>
> bool IsNumberWithError(T, string file=__FILE__, int line=__LINE__)() {
>        enum bool result = is( ...
>        if (!result)
>            __ctfeWriteln(file, "(", line, "): '", typeid(T), "' is not a number.");
>      return result;
> }
>

I consider pragma msg a superior solution for this specific case.

>
>> So does __ctfeWriteln.
>
> I know, but I hope __ctfeWriteln will become __ctfeWrite or someone will write a __ctfeWrite too. See the pull request for discussions about this. Having no way to avoid the ending newline is awful, it forces me to build large strings with appends and print them all at once instead of using just a series or writes. Not having an ending newline was my first requirement for an acceptable compile-time printing function.
>
> Bye,
> bearophile

I agree and don't think there are any valid counter-arguments.
Next ›   Last »
1 2
Top | Discussion index | About this forum | D home