Template constraints error messages using cputs()
BCS
none at anon.com
Sun Aug 8 07:41:59 PDT 2010
Hello BCS,
> Hello bearophile,
>
>> BCS:
>>
>>> How is pragma(msg,) buggy? It does exactly what it's supposed to do.
>>> Unless you can point to a deficiency that it has and something that
>>> fixes it. I see no reason to consider dumping it.
>>>
>> The thing it is supposed to do is not useful enough,
>>
> I dissagree. Strongly.
>
>> as I have explained in my bug report/enhancement request.
>>
> Link: http://d.puremagic.com/issues/show_bug.cgi?id=3952
>
> All the issues you address up to where you propose ctputs are bugs in
> DMD, not pragma(msg,...) as for ctputs as a /replacement/ see my
> replay to the bug.
>
>> And even if you want
>> to keep it, it's buggy & messy anyway, because it accepts as input
>> things that it is not able to digest correctly. It is currently
>> buggy,
>> and I see no reason to keep it when there is a better replacement. I
>> don't understand what people as you see good in pragma(msg), I think
>> you are just mistaken or you have not used it often enough yet.
> With regards to that, I have used it quite a lot so either you are
> just flat wrong or what you are talking about is something very
> esoteric that requiters huge amounts of experience to even begin to
> notice.
>
> While you may be able to convince me there are things that it can't do
> that are useful and maybe even that there are things that it does that
> it shouldn't, you will not convince me that what it currently does is
> less than /very useful/.
>
> My minimum requirements for a pragma(msgm...) replacement would be
> that it take any expression that results in an immutable(char[]) and,
> at compile time (and only compile time) during the semantic pass
> (while the code is processed, not evaluated) output the string.
>
> The major cases where your ctputs fails on this are inside a function
> that
> can be evaluated via CTFE:
> - If placed in a RT loop it could be evaluated to many times.
> - If placed in a code path that isn't hit via CTFE, it never outputs
> anything.
> - If the function gets run at RT, then you need to add a guard to
> prevent
> it from generating output at RT.
Oh, and it must be usable at any scope (without hacks):
module foo;
pragma(msg, "foo"); // note: a bare function call here woldn't work with
a CTFE function.
template Bar(string s) { pragam(msg, bar); }
class Baz(string s) { pragam(msg, bar); }
...
--
... <IXOYE><
More information about the Digitalmars-d
mailing list