food for thought - swift 5 released - bottom types, string interpolation, and stuff.

Basile B. b2.temp at gmx.com
Sat Apr 13 14:18:00 UTC 2019


On Saturday, 13 April 2019 at 12:38:03 UTC, Julian wrote:
> On Saturday, 13 April 2019 at 12:13:36 UTC, Basile B. wrote:
>> Hi posted a review on IRC:
>>
>> [13:10] <B4S1L3> It's a joke but I already see several bad 
>> things
>> [13:11] <B4S1L3> 1. parameter should be const to prevent 
>> superfluous template instantiation
>
> To be clear, the actual problem with that is that error messages
> aren't as clear, in some misuse like isOdd("not even a number") 
> ?
>
> And that a misuse will *accidentally* work, if & is overloaded.
>
>> [13:11] <B4S1L3> 2. no module name
>
> It has one though: isodd, the name of the file. Making that
> explicit might make it more like phobos modules but it probably
> also needs different style braces, javadoc-style comments, etc.
>
>> [13:11] <B4S1L3> 3. pragma(inline, true) not there
>
> I hadn't heard about that.
>
> @nogc @safe and such should also be there I suppose.
>
>> [13:12] <B4S1L3> 4. no test for BigInt
>> [13:12] <B4S1L3> "X" needs works, see review comments ;)
>> [13:13] <alphaglosined> expression isOdd(T:ulong)(T value) => 
>> value & 1;
>> [13:13] <B4S1L3> 5. floating point is accepted
>> ...
>> [13:15] <B4S1L3> so you see, this isOdd function we joke 
>> about. The package is not good. It's not phobos-grade at least
>
> Thanks.
>
> The real challenge will be to find a justification to bump
> the major version number :-)

`pragma(inline, true)` is not infered but the function attributes 
are. So... you should anotate your unittests with @safe pure 
nothrow @nogc and put the pragma for the tempalted funcs.

Anyway, I understand the joke, it's just like I think that the 
joke is not well executed ;)


More information about the Digitalmars-d mailing list