@AliCehreli: you may consider including Jonathan's trick in your book in the
para above this heading:
http://ddili.org/ders/d.en/const_and_immutable.html#ix_const_and_immutable.variable,
%20immutable
Jonathan M Davis via Digitalmars-d-learn wrote:
> yes, having
>
> enum s = ta("s)";
>
> and
ag0aep6g wrote:
> On 03.03.2016 07:12, Shriramana Sharma wrote:
>> string ta(string s) { return s ~ "1"; }
>> template ta(string s) { enum ta = ta(s); }
>
> In `ta(s)` here, `ta` is the enum itself again. It's similar to `int x =
> x;`. Can't do that, of course.
>
> Add a leading dot to refer
cym13 wrote:
> Note that parentheses are optional when no argument is provided.
Yes I know that but the point is I expected the compiler to identify
ta!"string" to refer to a different symbol than ta("string") where the one
is obviously a template and the other is obviously a function call.
On 03.03.2016 07:12, Shriramana Sharma wrote:
string ta(string s) { return s ~ "1"; }
template ta(string s) { enum ta = ta(s); }
In `ta(s)` here, `ta` is the enum itself again. It's similar to `int x =
x;`. Can't do that, of course.
Add a leading dot to refer to the module level `ta`
On Thursday, 3 March 2016 at 08:58:25 UTC, Shriramana Sharma
wrote:
Hello people and thanks for your replies.
Jonathan M Davis via Digitalmars-d-learn wrote:
You can't overload a function and an eponymous template like
that. They need to have distinct names.
Why is it not possible for the
On Thursday, March 03, 2016 14:28:25 Shriramana Sharma via Digitalmars-d-learn
wrote:
> Hello people and thanks for your replies.
>
> Jonathan M Davis via Digitalmars-d-learn wrote:
> > You can't overload a function and an eponymous template like that. They
> > need to have distinct names.
>
>
Dne 3.3.2016 v 09:58 Shriramana Sharma via Digitalmars-d-learn napsal(a):
Hello people and thanks for your replies.
Jonathan M Davis via Digitalmars-d-learn wrote:
You can't overload a function and an eponymous template like that. They
need to have distinct names.
Why is it not possible
Hello people and thanks for your replies.
Jonathan M Davis via Digitalmars-d-learn wrote:
> You can't overload a function and an eponymous template like that. They
> need to have distinct names.
Why is it not possible for the overload to happen? After all, the compiler
should be able to
On Thursday, March 03, 2016 11:42:13 Shriramana Sharma via Digitalmars-d-learn
wrote:
> Hello. I have a function I want to make CTFE-able as a template.
>
> string ta(string s) { return s ~ "1"; }
> template ta(string s) { enum ta = ta(s); }
> void main() { string s = ta!"s"; }
>
> Compiling the
Dne 3.3.2016 v 07:12 Shriramana Sharma via Digitalmars-d-learn napsal(a):
Hello. I have a function I want to make CTFE-able as a template.
string ta(string s) { return s ~ "1"; }
template ta(string s) { enum ta = ta(s); }
void main() { string s = ta!"s"; }
Compiling the above I get the
Hello. I have a function I want to make CTFE-able as a template.
string ta(string s) { return s ~ "1"; }
template ta(string s) { enum ta = ta(s); }
void main() { string s = ta!"s"; }
Compiling the above I get the errors:
(2): Error: forward reference of variable ta
(3): Error: template instance
11 matches
Mail list logo