Lutger wrote:
> Jonathan M Davis wrote:
>
>> Lutger wrote:
>>
>>>
>>> True, it only adds AssertError and that could be replaced with regular
>>> asserts.
>>>
>>> Thanks.
>>
>> ??? Regular asserts? When asserts in D fail, they throw an exception of
>> type AssertError. So, unless you're talkin
Jonathan M Davis wrote:
> Lutger wrote:
>
>>
>> True, it only adds AssertError and that could be replaced with regular
>> asserts.
>>
>> Thanks.
>
> ??? Regular asserts? When asserts in D fail, they throw an exception of
> type AssertError. So, unless you're talking about explicitly throwing a
Lutger wrote:
>
> True, it only adds AssertError and that could be replaced with regular
> asserts.
>
> Thanks.
??? Regular asserts? When asserts in D fail, they throw an exception of type
AssertError. So, unless you're talking about explicitly throwing an
AssertError yourself (which seems ra
Jonathan M Davis wrote:
...
>
> Generally, I speaking, I think that having functions which override
> functions from a base class and throw if they're used is a bad design. It
> may be that it makes perfect sense in some contexts, but generally, I'd
> consider it a very bad idea. Personally, I hat
Lutger wrote:
> What do you think of the following use of contracts?
>
> class Base
> {
> void useFeatureA()
> in { assert(false, "Base does not implement feature A"); }
> body
> {
> /* throw here? */
> }
>
> bool hasFeatureA()
> {
> return false;
>
What do you think of the following use of contracts?
class Base
{
void useFeatureA()
in { assert(false, "Base does not implement feature A"); }
body
{
/* throw here? */
}
bool hasFeatureA()
{
return false;
}
}
class Derived : Base
{
override