Re: Simple overloading without complications

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 18:52:08 UTC, Meta wrote: On Tuesday, 12 July 2016 at 04:23:07 UTC, Adam Sansier wrote: Now, I could simply make Do a template method but then this prevents it being a virtual function. void Do(T)(T name) if (is(T == string) || is(T == int)) { Init_Data();

Re: Simple overloading without complications

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 17:17:31 UTC, Kagamin wrote: On Tuesday, 12 July 2016 at 16:30:05 UTC, Adam Sansier wrote: Doesn't matter, it's not what I asked. Yeah, I'm not confident I understood your problem right. You can try to describe your problem better. Criteria: 1. At most 2 one par

Re: Simple overloading without complications

2016-07-12 Thread Meta via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 18:52:08 UTC, Meta wrote: On Tuesday, 12 July 2016 at 04:23:07 UTC, Adam Sansier wrote: Now, I could simply make Do a template method but then this prevents it being a virtual function. void Do(T)(T name) if (is(T == string) || is(T == int)) { Init_Data();

Re: Simple overloading without complications

2016-07-12 Thread Meta via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 04:23:07 UTC, Adam Sansier wrote: Now, I could simply make Do a template method but then this prevents it being a virtual function. void Do(T)(T name) if (is(T == string) || is(T == int)) { Init_Data(); static if (is(T == string)) { ...Get index

Re: Simple overloading without complications

2016-07-12 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 16:30:05 UTC, Adam Sansier wrote: Doesn't matter, it's not what I asked. Yeah, I'm not confident I understood your problem right. You can try to describe your problem better.

Re: Simple overloading without complications

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 16:42:52 UTC, Lodovico Giaretta wrote: On Tuesday, 12 July 2016 at 16:30:05 UTC, Adam Sansier wrote: Doesn't matter, it's not what I asked. Trying to provide answers to a question that wasn't asked and was clearly stated I wasn't interested in those types of answers.

Re: Simple overloading without complications

2016-07-12 Thread Lodovico Giaretta via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 16:27:52 UTC, Adam Sansier wrote: On Tuesday, 12 July 2016 at 13:54:16 UTC, Lodovico Giaretta Also note that yield semantics as available in various languages is much different from what you are proposing here. Not really. Yield is usually a break in flow, regardles

Re: Simple overloading without complications

2016-07-12 Thread Lodovico Giaretta via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 16:30:05 UTC, Adam Sansier wrote: Doesn't matter, it's not what I asked. Trying to provide answers to a question that wasn't asked and was clearly stated I wasn't interested in those types of answers. Every language has its own ways of solving various problems. We a

Re: Simple overloading without complications

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 16:03:15 UTC, Kagamin wrote: On Tuesday, 12 July 2016 at 13:44:02 UTC, Adam Sansier wrote: I don't like it, creates an extra function for no apparent reason except to get around the problem of not having a yield type of semantic. Again, I wasn't asking for any ol' so

Re: Simple overloading without complications

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 13:54:16 UTC, Lodovico Giaretta wrote: On Tuesday, 12 July 2016 at 13:44:02 UTC, Adam Sansier wrote: On Tuesday, 12 July 2016 at 08:52:26 UTC, Kagamin wrote: Extract functions for shared parts: void Do(string name) { DoStuff(); int i = find(name); DoStuf

Re: Simple overloading without complications

2016-07-12 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 13:44:02 UTC, Adam Sansier wrote: I don't like it, creates an extra function for no apparent reason except to get around the problem of not having a yield type of semantic. Again, I wasn't asking for any ol' solution, there are many ways to skin this cat. It's a no

Re: Simple overloading without complications

2016-07-12 Thread Lodovico Giaretta via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 13:44:02 UTC, Adam Sansier wrote: On Tuesday, 12 July 2016 at 08:52:26 UTC, Kagamin wrote: Extract functions for shared parts: void Do(string name) { DoStuff(); int i = find(name); DoStuffWithIndex(i); } void Do(int name) { DoStuff(); DoStuffWith

Re: Simple overloading without complications

2016-07-12 Thread Adam Sansier via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 08:52:26 UTC, Kagamin wrote: Extract functions for shared parts: void Do(string name) { DoStuff(); int i = find(name); DoStuffWithIndex(i); } void Do(int name) { DoStuff(); DoStuffWithIndex(i); } I don't like it, creates an extra function for no

Re: Simple overloading without complications

2016-07-12 Thread Kagamin via Digitalmars-d-learn
Extract functions for shared parts: void Do(string name) { DoStuff(); int i = find(name); DoStuffWithIndex(i); } void Do(int name) { DoStuff(); DoStuffWithIndex(i); }

Simple overloading without complications

2016-07-11 Thread Adam Sansier via Digitalmars-d-learn
I have a function that does some weird stuff, and can't really change it to make life easier(due to how windows work, COM, etc..). The function normally takes a string, a name, and does its think(which is the complex part that I can't change). But I also want to overload it so the function t