April 05
On 3/21/2024 12:39 PM, monkyyy wrote:
> i.e. `unittest(1==1)` would compile

It's an interesting idea, but it would close the door on ever having arguments to unittest blocks.
April 05
On Friday, 5 April 2024 at 15:38:28 UTC, Walter Bright wrote:
> On 3/21/2024 12:39 PM, monkyyy wrote:
>> i.e. `unittest(1==1)` would compile
>
> It's an interesting idea, but it would close the door on ever having arguments to unittest blocks.

why?

```d
unittest identity(T)(T i){
  assert(i==i);
}
identity(1);
identity(13.37);
```

```d
unittest(1==1,"math broke");
```

I dont think unittest syntax is constrained much
April 06
On Friday, 5 April 2024 at 17:34:43 UTC, monkyyy wrote:
> On Friday, 5 April 2024 at 15:38:28 UTC, Walter Bright wrote:
>> On 3/21/2024 12:39 PM, monkyyy wrote:
>>> i.e. `unittest(1==1)` would compile
>>
>> It's an interesting idea, but it would close the door on ever having arguments to unittest blocks.
>
> why?
>
> ```d
> unittest identity(T)(T i){
>   assert(i==i);
> }
> identity(1);
> identity(13.37);
> ```
>
> ```d
> unittest(1==1,"math broke");
> ```
>
> I dont think unittest syntax is constrained much

Instead why not just allow assert to be a top-level statement?
April 06
On Saturday, 6 April 2024 at 06:33:07 UTC, Meta wrote:
> On Friday, 5 April 2024 at 17:34:43 UTC, monkyyy wrote:
>> On Friday, 5 April 2024 at 15:38:28 UTC, Walter Bright wrote:
>>> On 3/21/2024 12:39 PM, monkyyy wrote:
>>>> i.e. `unittest(1==1)` would compile
>>>
>>> It's an interesting idea, but it would close the door on ever having arguments to unittest blocks.
>>
>> why?
>>
>> ```d
>> unittest identity(T)(T i){
>>   assert(i==i);
>> }
>> identity(1);
>> identity(13.37);
>> ```
>>
>> ```d
>> unittest(1==1,"math broke");
>> ```
>>
>> I dont think unittest syntax is constrained much
>
> Instead why not just allow assert to be a top-level statement?

I dont see a meaningful difference, if it was top level it would probably need a dummy context and a way to be run which will probably come from it acting like a unittest
1 2
Next ›   Last »