"Try it now"

spir denis.spir at gmail.com
Thu Apr 14 13:05:10 PDT 2011


On 04/14/2011 09:10 PM, Steven Schveighoffer wrote:
> On Thu, 14 Apr 2011 14:57:44 -0400, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> On 4/14/11 1:26 PM, Steven Schveighoffer wrote:
>>> On Thu, 14 Apr 2011 13:54:00 -0400, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>
>>>> On 4/14/11 12:26 PM, Steven Schveighoffer wrote:
>>>>> Any particular reason why adding a new trait is more
>>>>> desirable than modifying assert?
>>>>
>>>> Absolutely!
>>>
>>> Maybe I worded my question wrong. What I meant was what *is* the
>>> particular reason.
>>
>> Already mentioned it - enforce() is a prime example. Any similar facility
>> could make good use the feature.
>
> Sure. However, not modifying assert means all asserts in my code should now be
> rewritten to myassert, or whatever function is implemented. The huge benefit of
> modifying assert is that we don't have to change any existing code.
>
> I'm not saying adding a trait is not desirable, I just think it doesn't get us
> to the right place on its own.
>
> If I ever get around to hacking the compiler, I certainly will try this to see
> how well it works.

A solution may be to carefully craft the new trait-using func's interface so 
that upgrading can be automatised (rewriting tool for assert calls only); 
possibly with constraints to make the tool's life easier, like "assertions 
stands alone on their line".

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list