April 12, 2019
On 4/12/2019 9:38 PM, Nick Sabalausky (Abscissa) wrote:
> It's about the cognitive load.

As I pointed out upthread, isOdd() has a higher cognitive load.
April 13, 2019
On Saturday, 13 April 2019 at 04:40:08 UTC, Walter Bright wrote:
> On 4/12/2019 9:15 PM, Nick Sabalausky (Abscissa) wrote:
>> If for you, they're the same level of abstraction, that's great. For most, it isn't.
>
> If you want to write a library of such, and contribute it to Dub, feel free. If you find an audience for it, great.

Done: https://code.dlang.org/packages/isodd

It doesn't seem like there's a way to run library unit tests
with dub?

I'll add non-manpage documentation later.

And a logo, of course.
April 13, 2019
On 4/13/19 1:44 AM, Walter Bright wrote:
> On 4/12/2019 9:38 PM, Nick Sabalausky (Abscissa) wrote:
>> It's about the cognitive load.
> 
> As I pointed out upthread, isOdd() has a higher cognitive load.

Not for normal programmers.
April 13, 2019
On 4/13/19 1:37 AM, Walter Bright wrote:
> On 4/12/2019 10:18 PM, H. S. Teoh wrote:
>> writing (x % 2) conveys intent much better
>> than (x & 1).
> 
> They produced different code. Try this with your favorite C compiler:
> 
> int foo(int x)
> {
>      return x % 2;
> }
> 
> int bar(int x)
> {
>      return x & 1;
> }

Sounds like compiler room-for-improvement.
April 13, 2019
On Saturday, 13 April 2019 at 07:49:13 UTC, Nick Sabalausky (Abscissa) wrote:
> On 4/13/19 1:37 AM, Walter Bright wrote:
>> On 4/12/2019 10:18 PM, H. S. Teoh wrote:
>>> writing (x % 2) conveys intent much better
>>> than (x & 1).
>> 
>> They produced different code. Try this with your favorite C compiler:
>> 
>> int foo(int x)
>> {
>>      return x % 2;
>> }
>> 
>> int bar(int x)
>> {
>>      return x & 1;
>> }
>
> Sounds like compiler room-for-improvement.

Contrast https://godbolt.org/z/aN8rRV
April 13, 2019
On Saturday, 13 April 2019 at 07:04:23 UTC, Julian wrote:
> On Saturday, 13 April 2019 at 04:40:08 UTC, Walter Bright wrote:
>> On 4/12/2019 9:15 PM, Nick Sabalausky (Abscissa) wrote:
>>> If for you, they're the same level of abstraction, that's great. For most, it isn't.
>>
>> If you want to write a library of such, and contribute it to Dub, feel free. If you find an audience for it, great.
>
> Done: https://code.dlang.org/packages/isodd
>
> It doesn't seem like there's a way to run library unit tests
> with dub?
>
> I'll add non-manpage documentation later.
>
> And a logo, of course.

You can have different dub configurations, 1 of type library and 1 of type executable for the unit tests. The first configuration in the array list is the default configuration.

I have a very bad feeling about such small dub packages, because we are now on the same quality level like NodeJS ):

Kind regards
Andre
April 13, 2019
On Saturday, 13 April 2019 at 07:57:32 UTC, Julian wrote:
> On Saturday, 13 April 2019 at 07:49:13 UTC, Nick Sabalausky (Abscissa) wrote:
>> On 4/13/19 1:37 AM, Walter Bright wrote:
>>> On 4/12/2019 10:18 PM, H. S. Teoh wrote:
>>>> writing (x % 2) conveys intent much better
>>>> than (x & 1).
>>> 
>>> They produced different code. Try this with your favorite C compiler:
>>> 
>>> int foo(int x)
>>> {
>>>      return x % 2;
>>> }
>>> 
>>> int bar(int x)
>>> {
>>>      return x & 1;
>>> }
>>
>> Sounds like compiler room-for-improvement.
>
> Contrast https://godbolt.org/z/aN8rRV

er, these actually have the same unoptimized and -O3 output:

  int foo(int num) {
      return 0 == num % 2;
  }

  int bar(int num) {
      return 0 == (num & 1);
  }

https://godbolt.org/z/oqP0Mn
April 13, 2019
On 4/11/19 7:23 PM, Tony wrote:
> On Tuesday, 9 April 2019 at 06:23:26 UTC, aliak wrote:
>>
> 
>> [0] https://swift.org/blog/swift-5-released/
> 
> Still, no (official at least) Windows support. Don't know if that is because there is no interest in broadening the usage or if it is considered too difficult or not worth the effort to do so.
> 

It's probably because there's nothing in Swift that appeals to the same sheeple who consider it perfectly normal and acceptable in 2019 to hand your entire machine over to a randomly-activated process that hijacks all control over your own personal physical property (including the ability to close the lid, unplug it, and stick it into its own stupid carrying case so you can drive the F*&*ck home without corrupting the entire freaking operating system) for an *unspecified* number of **HOURS**, while requiring both fast internet access and ZERO interactivity, so it can perform the absolute most poorly-implemented update process **in computing history**, at its own discretion, while silently disabling your complex, hard-to-discover, unintuitively-activated pro-privacy settings.
April 13, 2019
On Saturday, 13 April 2019 at 07:57:32 UTC, Julian wrote:
>
> Contrast [snip]

er, these actually have the same unoptimized and -O3 output:

  int foo(int num) {
      return 0 == num % 2;
  }

  int bar(int num) {
      return 0 == (num & 1);
  }

links removed to see if this'll post.
April 13, 2019
On Saturday, 13 April 2019 at 05:37:31 UTC, Walter Bright wrote:
> On 4/12/2019 10:18 PM, H. S. Teoh wrote:
>> writing (x % 2) conveys intent much better
>> than (x & 1).
>
> They produced different code.

This is a non-sequitur, the fact that some compilers produce different assembly does not say anything about how well the functions convey intent.

However, in general, knowing that the bit-twiddling variety of a function produces different code to the mathematically precise expression, would just make me stop and think twice, three or even four times if just perhaps, it's better to stick to the mathematically precise and clear rendering of the desired algorithm.