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.
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
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
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
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
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
"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
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
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
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;
> >
"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
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
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
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
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
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
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
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
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
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
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
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.
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.
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
How does that address my question? I didn't suggest the
replacement or removal of syntax.
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
Is there any reason not to add this so you can use foo := bar as
a shorthand for auto foo = bar?
27 matches
Mail list logo