Re: function and variable

2015-02-09 Thread Vlad Levenfeld via Digitalmars-d-learn
On Tuesday, 10 February 2015 at 04:20:27 UTC, Fyodor Ustinov wrote: IMHO even if "it is not a bug, it is a feature" - it should not be compiled without notice. WBR, Fyodor. Agreed, should be a warning at least.

Re: function and variable

2015-02-09 Thread Fyodor Ustinov via Digitalmars-d-learn
On Tuesday, 10 February 2015 at 04:11:43 UTC, Vlad Levenfeld wrote: On Tuesday, 10 February 2015 at 03:59:22 UTC, Rikki Cattermole wrote: That's a bug. It should be using the function pointer. UFCS call should abide by the same scoping rules as anything else. https://issues.dlang.org/show_bug

Re: function and variable

2015-02-09 Thread Vlad Levenfeld via Digitalmars-d-learn
On Tuesday, 10 February 2015 at 03:59:22 UTC, Rikki Cattermole wrote: That's a bug. It should be using the function pointer. UFCS call should abide by the same scoping rules as anything else. https://issues.dlang.org/show_bug.cgi?id=14161 I thought that's how UFCS was explicitly designed? Gl

Re: function and variable

2015-02-09 Thread Fyodor Ustinov via Digitalmars-d-learn
On Tuesday, 10 February 2015 at 03:59:22 UTC, Rikki Cattermole wrote: That's a bug. It should be using the function pointer. UFCS call should abide by the same scoping rules as anything else. https://issues.dlang.org/show_bug.cgi?id=14161 Moreover. If the function is not defined (only pointe

Re: function and variable

2015-02-09 Thread Rikki Cattermole via Digitalmars-d-learn
On 10/02/2015 4:28 p.m., Fyodor Ustinov wrote: Hi! I think this code should not be compiled without any warning: import std.stdio; void f(int a) { writeln("it's a function! : ", a); } void main() { auto f = function (int a) {writeln("It's a variable! : ", a);}; 5.f(); f(5)

function and variable

2015-02-09 Thread Fyodor Ustinov via Digitalmars-d-learn
Hi! I think this code should not be compiled without any warning: import std.stdio; void f(int a) { writeln("it's a function! : ", a); } void main() { auto f = function (int a) {writeln("It's a variable! : ", a);}; 5.f(); f(5); } Output: it's a function! : 5 It's a variable