TypeFunction example: ImplictConvTargets

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Oct 7 11:10:15 UTC 2020


On 10/7/20 4:49 AM, Patrick Schluter wrote:
> On Wednesday, 7 October 2020 at 02:33:21 UTC, Andrei Alexandrescu wrote:
>> On 10/6/20 9:07 PM, claptrap wrote:
>>> On Tuesday, 6 October 2020 at 23:39:24 UTC, H. S. Teoh wrote:
>>>> On Tue, Oct 06, 2020 at 11:16:47PM +0000, claptrap via Digitalmars-d 
>>>> wrote: [...]
>>>>>
>>>> I would write it like this:
>>>>
>>>>     int[] vals = [4,7,28,23,585,73,12];
>>>>
>>>>     int[] getMultiplesOf(int i)
>>>>     {
>>>>         return vals.filter!(v => (v % i) == 0).array;
>>>>     }
>>>>
>>>> One line vs. 4, even more concise. ;-)
>>>
>>> The point is to show language not library.
>>
>> That's a made-up restriction, and it's odd that it is being discussed 
>> here as a virtue.
> 
> No, it's not. It's central to the argument.

Then the argument is specious.

I've been also tempted to do this on occasion to tilt a comparison one 
way or another - take C++ without STL or Boost, or Haskell without 
Prelude. The reality is these need to be considered together. (Make a 
hashtable in C++, no standard library allowed...)

>> Beginners are attracted to large languages that have everything built 
>> in. A good language is focused on general primitives that allow 
>> writing a great deal in libraries.
> 
> Then do lisp or forth but not D or C++.

Much of the size of C++ and D caters to library writers, and their 
standard libraries grew way faster than the core language - as they should.


More information about the Digitalmars-d mailing list