Re: Add := digraph to D

2012-06-22 Thread Michel Colman
I believe that auto has been redefined in C++11 as well. In both, all it really means is that the type is inferred. That's what I seemed to remember as well. Originally it had something to do with scope, but it was basically obsolete because that was the default anyway, so nobody was using it.

Re: Add := digraph to D

2012-06-22 Thread Michel Colman
I believe that auto has been redefined in C++11 as well. In both, all it really means is that the type is inferred. That's what I seemed to remember as well. Originally it had something to do with scope, but it was basically obsolete because that was the default storage class anyway, so nobod

Re: Add := digraph to D

2012-06-21 Thread Lars T. Kyllingstad
On Thursday, 21 June 2012 at 10:01:18 UTC, Jonathan M Davis wrote: On Thursday, June 21, 2012 11:14:40 Lars T. Kyllingstad wrote: That said, I was still wrong. :) I just tried it now, and apparently you can write pointless stuff like "auto extern int foo;" and DMD will compile it just fine. (A

Re: Add := digraph to D

2012-06-21 Thread Jonathan M Davis
On Thursday, June 21, 2012 11:14:40 Lars T. Kyllingstad wrote: > That said, I was still wrong. :) I just tried it now, and > apparently you can write pointless stuff like "auto extern int > foo;" and DMD will compile it just fine. (And, unless that is a > bug, it means D has redefined 'auto' to m

Re: Add := digraph to D

2012-06-21 Thread kenji hara
2012/6/21 Mehrdad : > On Thursday, 21 June 2012 at 05:54:32 UTC, Lars T. Kyllingstad wrote: >> >> No. Many don't realise this, but "auto" doesn't  actually stand for >> "automatic type inference". It is a storage class >> >> Lars > > > > auto int a = 5; > // Error: variable a storage class 'auto' h

Re: Add := digraph to D

2012-06-21 Thread Lars T. Kyllingstad
On Thursday, 21 June 2012 at 09:14:42 UTC, Lars T. Kyllingstad wrote: auto should probably be removed from the list of storage classes in the D spec, then. Or better, since the definition of StorageClass at http://dlang.org/declaration.html includes a bunch of things that aren't really storag

Re: Add := digraph to D

2012-06-21 Thread Christophe Travert
"Lars T. Kyllingstad" , dans le message (digitalmars.D:170381), a > That said, I was still wrong. :) I just tried it now, and > apparently you can write pointless stuff like "auto extern int > foo;" and DMD will compile it just fine. (And, unless that is a > bug, it means D has redefined 'auto

Re: Add := digraph to D

2012-06-21 Thread Lars T. Kyllingstad
On Thursday, 21 June 2012 at 08:12:58 UTC, Jonathan M Davis wrote: On Thursday, June 21, 2012 08:04:35 Christophe Travert wrote: "Lars T. Kyllingstad" , dans le message (digitalmars.D:170370), a >>> auto name = initializer; >>> const name = initializer; >>> immutable name = initializer; >>> sh

Re: Add := digraph to D

2012-06-21 Thread Andrea Fontana
I think he is speaking about "auto" keyword in c++. In c++ auto mean that. (local lifetime) On Thursday, 21 June 2012 at 08:12:58 UTC, Jonathan M Davis wrote: On Thursday, June 21, 2012 08:04:35 Christophe Travert wrote: "Lars T. Kyllingstad" , dans le message (digitalmars.D:170370), a >>> au

Re: Add := digraph to D

2012-06-21 Thread Jonathan M Davis
On Thursday, June 21, 2012 08:04:35 Christophe Travert wrote: > "Lars T. Kyllingstad" , dans le message (digitalmars.D:170370), a > > >>> auto name = initializer; > >>> const name = initializer; > >>> immutable name = initializer; > >>> shared name = initializer; > >>> enum name = initializer; > >

Re: Add := digraph to D

2012-06-21 Thread Christophe Travert
"Lars T. Kyllingstad" , dans le message (digitalmars.D:170370), a >>> auto name = initializer; >>> const name = initializer; >>> immutable name = initializer; >>> shared name = initializer; >>> enum name = initializer; >> >> After the first aren't these all just short hand for "const >> auto name

Re: Add := digraph to D

2012-06-21 Thread Mehrdad
On Thursday, 21 June 2012 at 05:54:32 UTC, Lars T. Kyllingstad wrote: No. Many don't realise this, but "auto" doesn't actually stand for "automatic type inference". It is a storage class Lars auto int a = 5; // Error: variable a storage class 'auto' has no effect if type is not inferred, d

Re: Add := digraph to D

2012-06-20 Thread Era Scarecrow
On Thursday, 21 June 2012 at 05:54:32 UTC, Lars T. Kyllingstad wrote: No. Many don't realize this, but "auto" doesn't actually stand for "automatic type inference". It is a storage class, like static, extern, etc., and it means that the variable stops existing at the end of the scope. It is, h

Re: Add := digraph to D

2012-06-20 Thread Lars T. Kyllingstad
On Wednesday, 20 June 2012 at 17:59:08 UTC, ixid wrote: Just as a question about the existing syntax as you listed combinations to learn as a negative: auto name = initializer; const name = initializer; immutable name = initializer; shared name = initializer; enum name = initializer; After

Re: Add := digraph to D

2012-06-20 Thread Era Scarecrow
On Wednesday, 20 June 2012 at 17:19:08 UTC, Jonathan M Davis wrote: Not to mention, there are some programming languages (e.g. Pascal) which use := for normal assignment, so it would be confusing for anyone familiar with those languages. AutoIt or AutoHotKeys is one, where = and := do two ver

Re: Add := digraph to D

2012-06-20 Thread Jesse Phillips
On Wednesday, 20 June 2012 at 14:36:48 UTC, ixid wrote: Is there any reason not to add this so you can use foo := bar as a shorthand for auto foo = bar? I would be against this change. There isn't much to say agaist it especially since => was fairly recently added (though has more benefit tha

Re: Add := digraph to D

2012-06-20 Thread Jonathan M Davis
On Wednesday, June 20, 2012 19:59:08 ixid wrote: > I see that this is not going to happen for D2 but as a debate for > a future D3 (and please just ignore my post if you find this in > some way exasperating, I am interested but do not mean to cause > friction): > > Just as a question about the exi

Re: Add := digraph to D

2012-06-20 Thread ixid
I see that this is not going to happen for D2 but as a debate for a future D3 (and please just ignore my post if you find this in some way exasperating, I am interested but do not mean to cause friction): Just as a question about the existing syntax as you listed combinations to learn as a ne

Re: Add := digraph to D

2012-06-20 Thread Robert DaSilva
On Wednesday, 20 June 2012 at 17:19:08 UTC, Jonathan M Davis wrote: On Wednesday, June 20, 2012 16:36:47 ixid wrote: Is there any reason not to add this so you can use foo := bar as a shorthand for auto foo = bar? Any proposed feature must have a solid use case and reason for being in the la

Re: Add := digraph to D

2012-06-20 Thread Jonathan M Davis
On Wednesday, June 20, 2012 16:36:47 ixid wrote: > Is there any reason not to add this so you can use foo := bar as > a shorthand for auto foo = bar? Any proposed feature must have a solid use case and reason for being in the language. It needs to add real value. If you want a feature in the lang

Re: Add := digraph to D

2012-06-20 Thread ixid
It is a terse way of assigning and initializing an automatically typed variable, helping meld what I understand one of D's aims to be that of the power of a C/C++ language with some of the syntactic elegance of languages like Python. In broad terms D and Go would seem to outline the general dir

Re: Add := digraph to D

2012-06-20 Thread ixid
Your array syntax suggestion is a good one. I think both make the syntax terser and more efficient which is a good justification for their use.

Re: Add := digraph to D

2012-06-20 Thread Bernard Helyer
On Wednesday, 20 June 2012 at 14:36:48 UTC, ixid wrote: Is there any reason not to add this so you can use foo := bar as a shorthand for auto foo = bar? No. That is not how it works. You don't swan in and say "WHY NOT ADD THIS SYNTAX GUYZ?" _You_ have to justify it. Tell _us_ why it's useful.

Re: Add := digraph to D

2012-06-20 Thread bearophile
ixid: How does that address my question? I didn't suggest the replacement or removal of syntax. I think your suggestion is not so useful because in many cases you don't want to use "auto". To justify the introduction of a new syntax it needs to cover many usage cases, or to do something tha

Re: Add := digraph to D

2012-06-20 Thread ixid
How does that address my question? I didn't suggest the replacement or removal of syntax.

Re: Add := digraph to D

2012-06-20 Thread bearophile
ixid: Is there any reason not to add this so you can use foo := bar as a shorthand for auto foo = bar? Often I prefer to write: const foo = bar; D is more complex than Go... Bye, bearophile

Add := digraph to D

2012-06-20 Thread ixid
Is there any reason not to add this so you can use foo := bar as a shorthand for auto foo = bar?