On Monday, 20 November 2023 at 08:47:34 UTC, Antonio wrote:
Now, I uncomment the ```writeln( "'Counter' is ", Counter );```
line and compiler says
```
/home/antonio/Devel/topbrokers/whatsapp-srv/admin/x.d(12):
Error: function `x.Counter(int nextValue)` is not callable
using argument types `()`
/home/antonio/Devel/topbrokers/whatsapp-srv/admin/x.d(12):
too few arguments, expected 1, got 0
```
I understand the problem with UFCS (``next`` is not using UFCS
because it is a delegate defined in the own main() function,
and ``Counter``` without () is treated as a function call
because it is UFCS eligible )
`writeln( "'Counter' is ", Counter );`
this code is actually internally looks like this
`writeln( "'Counter' is ", Counter() );`
if you meant to take the function/delegate and not invoke try
`&Counter` instead, otherwise it expects the parameters.
- What is the way to do ```writeln``` work with ```Counter```
function the same way it works with ```next``` function?
Sorry, that's too confusing and I have no idea what you mean,
maybe if you can explain what you are trying to achieve someone
might be able to help you.