Re: How to deprecate member function from outside?

2018-12-22 Thread Dru via Digitalmars-d-learn
You're right it did define two functions same signature and no compile error, heh

Re: How to deprecate member function from outside?

2018-12-22 Thread Neia Neutuladh via Digitalmars-d-learn
On Sat, 22 Dec 2018 21:33:14 +, Dru wrote: > The first example shows that it is possible to deprecate a function > separately from it's definition. No, it doesn't. You declared two *different* functions. One was deprecated; the other wasn't. > I want to know if it is possible to "fix" the se

Is InputRange intentionally more restrictive than isInputRange?

2018-12-22 Thread balddenimhero via Digitalmars-d-learn
I recently required a function to return an input range over some base element type E. I was under the impression that this is exactly what the interfaces in std.range.interface are for but found that these are more restrictive than the checks from std.range.primitives. In particular, isInput

Polymorphic hashOf

2018-12-22 Thread Per Nordlöw via Digitalmars-d-learn
If I want to include the class type (TypeInfo) inside a class instance hash, is the following snippet a good `@safe pure nothrow @nogc`-solution?: import core.internal.hash : hashOf; /** Hash that distinguishes `Expr(X)` from `NounExpr(X)`. */ hash_t hashOfPolymorphic(Class)(Class aClassInsta

Re: How to deprecate member function from outside?

2018-12-22 Thread Dru via Digitalmars-d-learn
Thanks for the reply I will try to explain what I mean: The first example shows that it is possible to deprecate a function separately from it's definition. The second example tries the same for a member function but it fails with a compile error. I want to know if it is possible to "fix"

Re: How to deprecate member function from outside?

2018-12-22 Thread Neia Neutuladh via Digitalmars-d-learn
On Sat, 22 Dec 2018 18:55:47 +, Dru wrote: > I would like to use "deprecated" on a member function, but do it from a > separate file > > this works: > /// > void func() {} > > deprecated { >void func(); > } You're defining two functions, presumably in two different modules and with two

How to deprecate member function from outside?

2018-12-22 Thread Dru via Digitalmars-d-learn
Hi, I would like to use "deprecated" on a member function, but do it from a separate file this works: /// void func() {} deprecated { void func(); } this doesn't work: class C{ void func() {} } deprecated { void C.func(); } I get: Error: semicolon expected, not . Thank

Re: Mixin operator 'if' directly

2018-12-22 Thread Basile B. via Digitalmars-d-learn
On Saturday, 22 December 2018 at 10:11:23 UTC, bauss wrote: On Saturday, 22 December 2018 at 03:44:09 UTC, Timoses wrote: Awesome hack! Being a hack, it would be even nicer if it worked ouf of the box: mixin template foo(bool b) { int _impl() { writeln(b); return int.init; }

Re: Mixin operator 'if' directly

2018-12-22 Thread bauss via Digitalmars-d-learn
On Saturday, 22 December 2018 at 03:44:09 UTC, Timoses wrote: Awesome hack! Being a hack, it would be even nicer if it worked ouf of the box: mixin template foo(bool b) { int _impl() { writeln(b); return int.init; } int _ipml2 = _impl(); } vs mixin template f

Re: Some Fundamental Paradigm Questions

2018-12-22 Thread Ron Tarrant via Digitalmars-d-learn
Thanks, Dennis and H.S. for the well-thought-out and comprehensive replies.

Re: Mixin operator 'if' directly

2018-12-22 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 22 December 2018 at 03:44:09 UTC, Timoses wrote: On Wednesday, 19 December 2018 at 15:40:50 UTC, Neia Neutuladh wrote: On Wed, 19 Dec 2018 15:12:14 +, bauss wrote: Or while instantiating it: mixin template foo() { int _ignoreme() { if (readln.strip == "abort") throw new

Re: How to reuse the space of RAM of an array of strings?

2018-12-22 Thread Giovanni Di Maria via Digitalmars-d-learn
On Friday, 21 December 2018 at 22:31:26 UTC, Steven Schveighoffer wrote: On 12/21/18 3:41 PM, Giovanni Di Maria wrote: [...] Note: alloca is a builtin intrinsic, so I wouldn't use that as a function name. Don't think it's affecting your program, but I wanted to point that out. [...] Th