Like Go/Rust, why not to have "func" keyword before function declaration

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 19 19:12:58 PST 2015


On 1/19/15 3:43 PM, Ary Borenszweig wrote:
> On 1/19/15 7:54 PM, Andrei Alexandrescu wrote:
>> On 1/19/15 2:49 PM, Ary Borenszweig wrote:
>>> On 1/19/15 6:25 PM, Andrei Alexandrescu wrote:
>>>> On 1/19/15 12:51 PM, Alexey T. wrote:
>>>>> Will be much easier to read Source, if func declarataion begins with
>>>>> keyword. "def" of "func". e.g.
>>>>>
>>>>> func myName(params.....): typeOfResult;
>>>>> or
>>>>> func myName(params...) -> typeOfResult;
>>>>>
>>>>> easier to read and PARSE. Next D version may allow--with compatability
>>>>> of old syntad (C like where typeOfResult is 1st id).
>>>>
>>>> No. -- Andrei
>>>
>>> How do you search for a function definition?
>>>
>>> In Ruby I search "def some_name" and I find it. In Go I can probably
>>> search "func some_name". In Rust, "fn some_name".
>>>
>>> Browsing some C code for Ruby I search with regex with "^some_name"
>>> because they have the convention of writing functions like this:
>>>
>>> return_type
>>> function_name(...) {
>>> }
>>>
>>> It works, but if you stop following that convention you are lost.
>>>
>>> So... how do you search for a function definition in D without an IDE?
>>
>> I abandon D and switch to Ruby. -- Andrei
>
> Thanks for the answer.

"Tel maƮtre, tel valet." -- Andrei


More information about the Digitalmars-d mailing list