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

2015-01-21 Thread Danni Coy via Digitalmars-d
regular expression search FunctionName.*\{ or FunctionName.*$\s*\{
depending on brace style

On Wed, Jan 21, 2015 at 4:37 AM, Joakim via Digitalmars-d
digitalmars-d@puremagic.com wrote:
 On Tuesday, 20 January 2015 at 00:13:37 UTC, Brian Schott wrote:

 On Monday, 19 January 2015 at 22:49:41 UTC, Ary Borenszweig wrote:

 So... how do you search for a function definition in D without an IDE?


 Running `dscanner --help` prints this:

 --declaration | -d symbolName [sourceFiles sourceDirectories]
 Find the location where symbolName is declared. This should be more
 accurate than grep. Searches the given files and directories, or the
 current working directory if none are specified.


 ^
 THIS!

 I agree with Ary that grep hits a lot of false positives and all the
 formatting tricks don't work with other people's code, plus I've never liked
 IDES.  Dscanner's D declaration finder has become indispensable in the short
 time I've been using it, to the point where I dread going back to searching
 for C declarations and getting stuck with grep again.


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

2015-01-20 Thread Kagamin via Digitalmars-d

On Monday, 19 January 2015 at 20:51:03 UTC, 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).


Why reinvent pascal, but worse? Just go with it: 
http://freepascal.org/


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

2015-01-20 Thread Steven Schveighoffer via Digitalmars-d

On 1/19/15 8:35 PM, Ary Borenszweig wrote:

On 1/19/15 9:17 PM, Walter Bright wrote:

On 1/19/2015 2:49 PM, Ary Borenszweig wrote:

So... how do you search for a function definition in D without an IDE?


I do a text search for the name of the function.

I've been programming in C, C++, and D for 30 years without an IDE. It
never occurred to me that this was not doable :-)


But the results will also contain invocations of that function. Do you
go one by one until you find the definition?


Yep. Do it all the time. It's not that hard to see the difference 
between a definition and usage.


-Steve


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

2015-01-20 Thread MattCoder via Digitalmars-d
On Tuesday, 20 January 2015 at 13:47:11 UTC, ketmar via 
Digitalmars-d wrote:

  void function foo () { ... }
  foo();

do you see the subtle difference? yes, that tiny whitespace in
declaration. i borrowed that habit from some Oberon code 
decades ago, and it serves me well since then.


Hmm, nice one. I think I'll do this too.

Matheus.



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

2015-01-20 Thread ketmar via Digitalmars-d
On Mon, 19 Jan 2015 22:35:16 -0300
Ary Borenszweig via Digitalmars-d digitalmars-d@puremagic.com wrote:

 On 1/19/15 9:17 PM, Walter Bright wrote:
  On 1/19/2015 2:49 PM, Ary Borenszweig wrote:
  So... how do you search for a function definition in D without an IDE?
 
  I do a text search for the name of the function.
 
  I've been programming in C, C++, and D for 30 years without an IDE. It
  never occurred to me that this was not doable :-)
 
 But the results will also contain invocations of that function. Do you 
 go one by one until you find the definition?
heh.

  void function foo () { ... }
  foo();

do you see the subtle difference? yes, that tiny whitespace in
declaration. i borrowed that habit from some Oberon code decades ago,
and it serves me well since then.


signature.asc
Description: PGP signature


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

2015-01-20 Thread ketmar via Digitalmars-d
On Tue, 20 Jan 2015 13:49:47 +
MattCoder via Digitalmars-d digitalmars-d@puremagic.com wrote:

 On Tuesday, 20 January 2015 at 13:47:11 UTC, ketmar via 
 Digitalmars-d wrote:
void function foo () { ... }
foo();
 
  do you see the subtle difference? yes, that tiny whitespace in
  declaration. i borrowed that habit from some Oberon code 
  decades ago, and it serves me well since then.
 
 Hmm, nice one. I think I'll do this too.
be my guest. ;-) i'll be glad if it will help you.

the only bad thing i found with this style is that after some time you
really start noticing the absense of whitespace in declaraions, and it
annoys you. so the first thing you want to do with someone's code is to
ADD THAT WHITESPACES! somehow it becomes most frustrating element of
alien code styling. ;-)


signature.asc
Description: PGP signature


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

2015-01-20 Thread Joakim via Digitalmars-d

On Tuesday, 20 January 2015 at 00:13:37 UTC, Brian Schott wrote:
On Monday, 19 January 2015 at 22:49:41 UTC, Ary Borenszweig 
wrote:
So... how do you search for a function definition in D without 
an IDE?


Running `dscanner --help` prints this:

--declaration | -d symbolName [sourceFiles sourceDirectories]
Find the location where symbolName is declared. This should 
be more
accurate than grep. Searches the given files and 
directories, or the

current working directory if none are specified.


^
THIS!

I agree with Ary that grep hits a lot of false positives and all 
the formatting tricks don't work with other people's code, plus 
I've never liked IDES.  Dscanner's D declaration finder has 
become indispensable in the short time I've been using it, to the 
point where I dread going back to searching for C declarations 
and getting stuck with grep again.


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

2015-01-20 Thread Walter Bright via Digitalmars-d

On 1/20/2015 12:30 PM, Jonathan Marler wrote:

Which editor do you use?


https://github.com/DigitalMars/me



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

2015-01-20 Thread Jonathan Marler via Digitalmars-d

On Tuesday, 20 January 2015 at 03:28:29 UTC, Walter Bright wrote:

On 1/19/2015 7:20 PM, Walter Bright wrote:
Yes. Search Again is a single button press. It really has 
never occurred to me

that this might be a problem needing a solution.


I admit that I've never gotten in to using an IDE. I still have 
complaints about the programmer's editor I use, but they aren't 
big enough to motivate me to fix it!


The nice thing about my editor is it works exactly the same on:

Windows
Linux
FreeBSD
OSX
in a remote tty text window

and is small enough to load instantly.


Which editor do you use?  I use emacs.  It has some quirks.  The 
D-Mode doesn't work very well (I end up using Notepad++ when 
working on phobos/druntime), but I can use it on every platform 
and over a remote tty so I deal with its imperfections.


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

2015-01-20 Thread ketmar via Digitalmars-d
On Tue, 20 Jan 2015 20:30:00 +
Jonathan Marler via Digitalmars-d digitalmars-d@puremagic.com wrote:

 On Tuesday, 20 January 2015 at 03:28:29 UTC, Walter Bright wrote:
  On 1/19/2015 7:20 PM, Walter Bright wrote:
  Yes. Search Again is a single button press. It really has 
  never occurred to me
  that this might be a problem needing a solution.
 
  I admit that I've never gotten in to using an IDE. I still have 
  complaints about the programmer's editor I use, but they aren't 
  big enough to motivate me to fix it!
 
  The nice thing about my editor is it works exactly the same on:
 
  Windows
  Linux
  FreeBSD
  OSX
  in a remote tty text window
 
  and is small enough to load instantly.
 
 Which editor do you use?  I use emacs.  It has some quirks.  The 
 D-Mode doesn't work very well (I end up using Notepad++ when 
 working on phobos/druntime), but I can use it on every platform 
 and over a remote tty so I deal with its imperfections.
might it be microemacs from Digital Mars site? ;-)


signature.asc
Description: PGP signature


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

2015-01-20 Thread Danni Coy via Digitalmars-d
 So... how do you search for a function definition in D without an IDE?

Regular Expression Search for

FunctionName.*\n\s*\{

or

FunctionName.*\{

depending on brace style being used.


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

2015-01-19 Thread Vlad Levenfeld via Digitalmars-d

On Tuesday, 20 January 2015 at 01:35:17 UTC, Ary Borenszweig
wrote:

On 1/19/15 9:17 PM, Walter Bright wrote:

On 1/19/2015 2:49 PM, Ary Borenszweig wrote:
So... how do you search for a function definition in D 
without an IDE?


I do a text search for the name of the function.

I've been programming in C, C++, and D for 30 years without an 
IDE. It

never occurred to me that this was not doable :-)


But the results will also contain invocations of that function. 
Do you go one by one until you find the definition?


First instance of function name preceding an open brace following 
a
closed paren before a semicolon. Its a mouthful but the regex 
isn't that complex if you are comfortable with lookahead/behind


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

2015-01-19 Thread Ary Borenszweig via Digitalmars-d

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?


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

2015-01-19 Thread deadalnix via Digitalmars-d

On Monday, 19 January 2015 at 21:06:40 UTC, Alexey T. wrote:

Better that next D version (next MAJOR version) can support such
syntax. (Old syntax may be compatible too but deprecated).

What developers think..


That why not is a not a good enough reason to do it.


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

2015-01-19 Thread weaselcat via Digitalmars-d

On Tuesday, 20 January 2015 at 00:13:37 UTC, Brian Schott wrote:
On Monday, 19 January 2015 at 22:49:41 UTC, Ary Borenszweig 
wrote:
So... how do you search for a function definition in D without 
an IDE?


Running `dscanner --help` prints this:

--declaration | -d symbolName [sourceFiles sourceDirectories]
Find the location where symbolName is declared. This should 
be more
accurate than grep. Searches the given files and 
directories, or the

current working directory if none are specified.


you posted this while I was reading the first page : (

guess I could add an addendum
I don't think being able to find a function by grepping func 
foo is anywhere near a valid reason for adding this syntax. 
Programming languages should be made for humans to read, and 
having func just adds visual noise.


...
*cough*function attributes


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

2015-01-19 Thread Walter Bright via Digitalmars-d

On 1/19/2015 2:49 PM, Ary Borenszweig wrote:

So... how do you search for a function definition in D without an IDE?


I do a text search for the name of the function.

I've been programming in C, C++, and D for 30 years without an IDE. It never 
occurred to me that this was not doable :-)


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

2015-01-19 Thread Walter Bright via Digitalmars-d

On 1/19/2015 2:51 PM, ponce wrote:

Current syntax is akin to C and C++, it means many people already read it
visually and it is easier to port C code to D.


Bingo. It's designed to be an easy transition for people used to programming in 
C, C++ and Java.


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

2015-01-19 Thread Israel via Digitalmars-d

On Monday, 19 January 2015 at 21:25:16 UTC, 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


LOL.

That reply...


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

2015-01-19 Thread Andrei Alexandrescu via Digitalmars-d

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


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

2015-01-19 Thread Ary Borenszweig via Digitalmars-d

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.


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

2015-01-19 Thread H. S. Teoh via Digitalmars-d
On Mon, Jan 19, 2015 at 04:17:08PM -0800, Walter Bright via Digitalmars-d wrote:
 On 1/19/2015 2:49 PM, Ary Borenszweig wrote:
 So... how do you search for a function definition in D without an
 IDE?
 
 I do a text search for the name of the function.
 
 I've been programming in C, C++, and D for 30 years without an IDE. It
 never occurred to me that this was not doable :-)

Me too(tm), for 20 years.


T

-- 
It is not the employer who pays the wages. Employers only handle the money. It 
is the customer who pays the wages. -- Henry Ford


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

2015-01-19 Thread Ary Borenszweig via Digitalmars-d

On 1/19/15 9:17 PM, Walter Bright wrote:

On 1/19/2015 2:49 PM, Ary Borenszweig wrote:

So... how do you search for a function definition in D without an IDE?


I do a text search for the name of the function.

I've been programming in C, C++, and D for 30 years without an IDE. It
never occurred to me that this was not doable :-)


But the results will also contain invocations of that function. Do you 
go one by one until you find the definition?


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

2015-01-19 Thread Walter Bright via Digitalmars-d

On 1/19/2015 5:35 PM, Ary Borenszweig wrote:

On 1/19/15 9:17 PM, Walter Bright wrote:

On 1/19/2015 2:49 PM, Ary Borenszweig wrote:

So... how do you search for a function definition in D without an IDE?


I do a text search for the name of the function.

I've been programming in C, C++, and D for 30 years without an IDE. It
never occurred to me that this was not doable :-)


But the results will also contain invocations of that function. Do you go one by
one until you find the definition?


Yes. Search Again is a single button press. It really has never occurred to me 
that this might be a problem needing a solution.


Of course, I'm careful not to name my functions the.


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

2015-01-19 Thread deadalnix via Digitalmars-d
On Tuesday, 20 January 2015 at 03:12:52 UTC, Andrei Alexandrescu 
wrote:

Tel maître, tel valet. -- Andrei


Will ruby now park cars ?


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

2015-01-19 Thread ponce via Digitalmars-d

On Monday, 19 January 2015 at 22:18:34 UTC, Alexey T. wrote:
Ok I see your arguments, indeed, breaking masss of code isn't 
good (even with deprecated flag).

So leave it as is (it is TOO LATE to change this)


Current syntax is akin to C and C++, it means many people already 
read it visually and it is easier to port C code to D.


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

2015-01-19 Thread Andrei Alexandrescu via Digitalmars-d

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


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

2015-01-19 Thread Brian Schott via Digitalmars-d

On Monday, 19 January 2015 at 22:49:41 UTC, Ary Borenszweig wrote:
So... how do you search for a function definition in D without 
an IDE?


Running `dscanner --help` prints this:

--declaration | -d symbolName [sourceFiles sourceDirectories]
Find the location where symbolName is declared. This should 
be more
accurate than grep. Searches the given files and 
directories, or the

current working directory if none are specified.


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

2015-01-19 Thread Jon via Digitalmars-d
On Tuesday, 20 January 2015 at 01:35:17 UTC, Ary Borenszweig 
wrote:

On 1/19/15 9:17 PM, Walter Bright wrote:

On 1/19/2015 2:49 PM, Ary Borenszweig wrote:
So... how do you search for a function definition in D 
without an IDE?


I do a text search for the name of the function.

I've been programming in C, C++, and D for 30 years without an 
IDE. It

never occurred to me that this was not doable :-)


But the results will also contain invocations of that function. 
Do you go one by one until you find the definition?


Sure. If it is a very commonly-used function (like a library 
function), the definition is probably in a different file from 
the one most of the invocations are in anyhow.


-Jon


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

2015-01-19 Thread Walter Bright via Digitalmars-d

On 1/19/2015 7:20 PM, Walter Bright wrote:

Yes. Search Again is a single button press. It really has never occurred to me
that this might be a problem needing a solution.


I admit that I've never gotten in to using an IDE. I still have complaints about 
the programmer's editor I use, but they aren't big enough to motivate me to fix it!


The nice thing about my editor is it works exactly the same on:

Windows
Linux
FreeBSD
OSX
in a remote tty text window

and is small enough to load instantly.



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

2015-01-19 Thread Walter Bright via Digitalmars-d

On 1/19/2015 1:23 PM, Jonathan Marler wrote:

I'm not familiar enough
with the syntax grammar to say for sure whether or not this would make it easier
to parse the language.


This idea is not going to make the parsing any better.


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

2015-01-19 Thread weaselcat via Digitalmars-d

On Monday, 19 January 2015 at 22:49:41 UTC, 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?


dscanner -d


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

2015-01-19 Thread Dicebot via Digitalmars-d
On Monday, 19 January 2015 at 22:54:04 UTC, Andrei Alexandrescu 
wrote:

I abandon D and switch to Ruby. -- Andrei


You should make a front page announcement.


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

2015-01-19 Thread Rikki Cattermole via Digitalmars-d

On 20/01/2015 1:17 p.m., Walter Bright wrote:

On 1/19/2015 2:49 PM, Ary Borenszweig wrote:

So... how do you search for a function definition in D without an IDE?


I do a text search for the name of the function.

I've been programming in C, C++, and D for 30 years without an IDE. It
never occurred to me that this was not doable :-)


I've only been programming for 8 years on and off IDE's.
And I must say, even I do the old search for function names even when in 
an IDE! Thanks MonoD and friends! You do great on the searching!


I'm not really complaining. Once we have Intellij IDEA plugin fully 
working, these problems will go away altogether. Since it cache's AST 
and bunch of other nice tricks.


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

2015-01-19 Thread Mike Parker via Digitalmars-d

On 1/20/2015 7:49 AM, Ary Borenszweig wrote:



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?


Case-insensitive search on funcname( usually works for me.


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

2015-01-19 Thread Jonathan M Davis via Digitalmars-d
On Monday, January 19, 2015 16:18:25 Walter Bright via Digitalmars-d wrote:
 On 1/19/2015 2:51 PM, ponce wrote:
  Current syntax is akin to C and C++, it means many people already read it
  visually and it is easier to port C code to D.

 Bingo. It's designed to be an easy transition for people used to programming 
 in
 C, C++ and Java.

That and the fact that most of the folks working on the language have been
programming in C, C++, etc. for years, and it probably never occurred to
most of them to have a different function declaration syntax in the first
place. Even if there's a better way to do something, if it never occurs to
you that there's anything wrong with the current way, you're not going to
come up with a new one.

- Jonathan M Davis



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

2015-01-19 Thread Jonathan M Davis via Digitalmars-d
On Monday, January 19, 2015 20:51:02 Alexey T. via Digitalmars-d 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).

I don't recall ever having any problem with the C/C++ syntax that D uses.
The major problem was with the function pointer syntax, and we already fixed
that. I really don't see how changing the function signature syntax in D
would help anything, and it would force all existing code to be changed (be
it immediately or just when the compatability flag finally goes anyway).
Sometimes, syntax improvements are worth it, but in general, it's just not
worth messing with the syntax unless the language is still in flux enough
that you don't care at all about breaking existing code. So, even if your
suggestion were objectively better (and it really isn't), we probably
wouldn't go with it at this point.

- Jonathan M Davis



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

2015-01-19 Thread Alexey T. via Digitalmars-d
Ok I see your arguments, indeed, breaking masss of code isn't 
good (even with deprecated flag).

So leave it as is (it is TOO LATE to change this)


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

2015-01-19 Thread Alexey T. via Digitalmars-d

Better that next D version (next MAJOR version) can support such
syntax. (Old syntax may be compatible too but deprecated).

What developers think..


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

2015-01-19 Thread Jonathan Marler via Digitalmars-d

On Monday, 19 January 2015 at 21:06:40 UTC, Alexey T. wrote:

Better that next D version (next MAJOR version) can support such
syntax. (Old syntax may be compatible too but deprecated).

What developers think..


I have a feeling you might get some strong opposition to this 
idea *Brace Yourself*.  However, I don't mind discussing new 
ideas.  I'm not familiar enough with the syntax grammar to say 
for sure whether or not this would make it easier to parse the 
language.  If it does, I wouldn't think it would make it much 
more simple.  One question is how would you declare a function 
pointer?


Current : void function() myfunction;
YourIdea: func void function() myfunction;

This seems a little odd/redundant. I suppose you could change the 
syntax to something like this:


func void myfunction();

But then you wouldn't be able to know if that was a function 
pointer or a function declaration.


I'll finish by saying that at first glance, I'm not sure if 
adding this extra keyword will help readability much.  I've never 
really had problems distinguishing between functions and other 
things.  That being said, maybe I've been programming in C-like 
languages too much so take that with a grain of salt.


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

2015-01-19 Thread Andrei Alexandrescu via Digitalmars-d

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


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

2015-01-19 Thread bachmeier via Digitalmars-d

On Monday, 19 January 2015 at 20:51:03 UTC, 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).


I have nothing against Rust, but that's the last place I'd go if 
I were looking for improved syntax. Personally I view it as 
visual clutter that will make it harder to read the program.


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

2015-01-19 Thread ketmar via Digitalmars-d
On Mon, 19 Jan 2015 20:51:02 +
Alexey T. via Digitalmars-d digitalmars-d@puremagic.com 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).
maybe it's better to just stick with go/rust then? really, everybody
knows where to download that compilers, yet they comes here and using
D...


signature.asc
Description: PGP signature