On 2017-05-03 14:50, Adam D. Ruppe wrote:
No accident there, the spec says any storage class will do:
http://dlang.org/spec/function.html#auto-functions
"An auto function is declared without a return type. If it does not
already have a storage class, use the auto storage class. "
I see.
--
On Wednesday, 3 May 2017 at 07:37:31 UTC, Jacob Carlborg wrote:
It might be by accident but I think the compiler is inferring
the return type. Just as "auto" is not necessary to infer the
type of a variable if there's another attribute:
No accident there, the spec says any storage class will
On Wednesday, 3 May 2017 at 09:21:47 UTC, nkm1 wrote:
On Wednesday, 3 May 2017 at 07:34:03 UTC, Daniel Kozák wrote:
print in A is template:
What :)
How does it interact with 'final'?
If it were a template (and it's not), then final would not be
applicable, because templated functions
On Wednesday, 3 May 2017 at 07:34:03 UTC, Daniel Kozák wrote:
V Wed, 03 May 2017 06:54:15 +
nkm1 via Digitalmars-d-learn
napsáno:
Consider:
import std.stdio;
class A
{
final print() { writeln(this); } // no return type
}
class B : A
{
final
V Wed, 03 May 2017 09:21:47 +
nkm1 via Digitalmars-d-learn
napsáno:
> On Wednesday, 3 May 2017 at 07:34:03 UTC, Daniel Kozák wrote:
> >
> > print in A is template:
> >
>
> What :)
> How does it interact with 'final'?
hmm obviously it is problem only
V Wed, 03 May 2017 09:21:47 +
nkm1 via Digitalmars-d-learn
napsáno:
> On Wednesday, 3 May 2017 at 07:34:03 UTC, Daniel Kozák wrote:
> >
> > print in A is template:
> >
>
> What :)
> How does it interact with 'final'?
final is not important here
On Wednesday, 3 May 2017 at 07:34:03 UTC, Daniel Kozák wrote:
print in A is template:
What :)
How does it interact with 'final'?
On Wednesday, 3 May 2017 at 06:54:15 UTC, nkm1 wrote:
final method type inference stuff
Jacob and Jonathan - thank you, this is clear to me now.
Hopefully it will get fixed at some point.
On Wednesday, 3 May 2017 at 08:10:04 UTC, Jonathan M Davis wrote:
So, I'd say that there's definitely a bug here.
https://issues.dlang.org/show_bug.cgi?id=17366
On Wednesday, 3 May 2017 at 07:37:31 UTC, Jacob Carlborg wrote:
It might be by accident but I think the compiler is inferring
the return type. Just as "auto" is not necessary to infer the
type of a variable if there's another attribute:
auto a = 3;
const auto b = 4; // here "auto" is
On 2017-05-03 08:54, nkm1 wrote:
Consider:
import std.stdio;
class A
{
final print() { writeln(this); } // no return type
}
class B : A
{
final void print() { writeln(this); }
}
void main()
{
auto b = new B;
b.print();
A a1 = b;
a1.print();
A a2 = new A;
V Wed, 03 May 2017 06:54:15 +
nkm1 via Digitalmars-d-learn
napsáno:
> Consider:
>
> import std.stdio;
>
> class A
> {
> final print() { writeln(this); } // no return type
> }
>
> class B : A
> {
> final void print() { writeln(this); }
> }
>
>
Consider:
import std.stdio;
class A
{
final print() { writeln(this); } // no return type
}
class B : A
{
final void print() { writeln(this); }
}
void main()
{
auto b = new B;
b.print();
A a1 = b;
a1.print();
A a2 = new A;
a2.print();
}
That compiles:
$ dmd
13 matches
Mail list logo