digitalmars.D.learn - base class function hiding
- bc (6/6) Oct 11 2007 It's so annoying. I'm always running into difficulties with this. The
- Regan Heath (3/9) Oct 11 2007 The problem is larger than personal preference, have a search through
- bc (7/16) Oct 11 2007 Thanks for the pointer. Sorry if I was rude BTW. I'd been messing around
- Bill Baxter (9/29) Oct 11 2007 With a string mixin and CTFE you should be able to generate the required...
- Regan Heath (6/27) Oct 12 2007 It wasn't that, it's just that this topic comes up every now and again
- Manfred Nowak (4/6) Oct 13 2007 What's wrong with
- Bill Baxter (6/16) Oct 13 2007 *) No compile-time check on exceeding the valid number of arguments.
- Manfred Nowak (3/7) Oct 14 2007 thx
It's so annoying. I'm always running into difficulties with this. The times a function has been hidden when I didn't want it hidden outnumber the reverse case 20 to 1 or more. Especially with templates and mixins. I'm sure someone will say it it's better this way but I don't buy it. I really would prefer functions to never be hidden unless specifically requested. What can be done about this?
Oct 11 2007
bc wrote:It's so annoying. I'm always running into difficulties with this. The times a function has been hidden when I didn't want it hidden outnumber the reverse case 20 to 1 or more. Especially with templates and mixins. I'm sure someone will say it it's better this way but I don't buy it. I really would prefer functions to never be hidden unless specifically requested. What can be done about this?The problem is larger than personal preference, have a search through these groups and the archives on digitalmars.com/d.
Oct 11 2007
On Thu, 11 Oct 2007 18:51:25 +0100, Regan Heath <regan netmail.co.nz> wrote:bc wrote:Thanks for the pointer. Sorry if I was rude BTW. I'd been messing around trying to make a rectangular array class in C++, that must have an opIndex with variable number of arguments up to the number of dimensions, got p***ed off with that, thought 'i bet this is easier in D' and found that it wasn't.It's so annoying. I'm always running into difficulties with this. The times a function has been hidden when I didn't want it hidden outnumber the reverse case 20 to 1 or more. Especially with templates and mixins. I'm sure someone will say it it's better this way but I don't buy it. I really would prefer functions to never be hidden unless specifically requested. What can be done about this?The problem is larger than personal preference, have a search through these groups and the archives on digitalmars.com/d.
Oct 11 2007
bc wrote:On Thu, 11 Oct 2007 18:51:25 +0100, Regan Heath <regan netmail.co.nz> wrote:With a string mixin and CTFE you should be able to generate the required functions on the fly. Take a look at the code here (first one on the page should do it): http://www.dsource.org/forums/viewtopic.php?t=3170&postdays=0&postorder=asc&start=0 It'll take some wading through, but if you're patient you should be able to figure out how to turn that into code that generates N different opIndex functions. --bbbc wrote:Thanks for the pointer. Sorry if I was rude BTW. I'd been messing around trying to make a rectangular array class in C++, that must have an opIndex with variable number of arguments up to the number of dimensions, got p***ed off with that, thought 'i bet this is easier in D' and found that it wasn't.It's so annoying. I'm always running into difficulties with this. The times a function has been hidden when I didn't want it hidden outnumber the reverse case 20 to 1 or more. Especially with templates and mixins. I'm sure someone will say it it's better this way but I don't buy it. I really would prefer functions to never be hidden unless specifically requested. What can be done about this?The problem is larger than personal preference, have a search through these groups and the archives on digitalmars.com/d.
Oct 11 2007
bc wrote:On Thu, 11 Oct 2007 18:51:25 +0100, Regan Heath <regan netmail.co.nz> wrote:It wasn't that, it's just that this topic comes up every now and again and it also happens to be a hard one to explain so it's better to re-use the old conversations if possible.bc wrote:Thanks for the pointer. Sorry if I was rude BTW.It's so annoying. I'm always running into difficulties with this. The times a function has been hidden when I didn't want it hidden outnumber the reverse case 20 to 1 or more. Especially with templates and mixins. I'm sure someone will say it it's better this way but I don't buy it. I really would prefer functions to never be hidden unless specifically requested. What can be done about this?The problem is larger than personal preference, have a search through these groups and the archives on digitalmars.com/d.I'd been messing around trying to make a rectangular array class in C++, that must have an opIndex with variable number of arguments up to the number of dimensions, got p***ed off with that, thought 'i bet this is easier in D' and found that it wasn't.Looks like Bill is sorting you out :) Regan
Oct 12 2007
bc wrotemust have an opIndex with variable number of arguments up to the number of dimensionsWhat's wrong with void opIndex(size_t[] arg ...) -manfred
Oct 13 2007
Manfred Nowak wrote:bc wrote*) No compile-time check on exceeding the valid number of arguments. *) the return type shouldn't be "void" but an N-nargs (N minus args.length) dimensional array. Since N is a template parameter, each function must return a different type. --bbmust have an opIndex with variable number of arguments up to the number of dimensionsWhat's wrong with void opIndex(size_t[] arg ...) -manfred
Oct 13 2007
Bill Baxter wrote*) No compile-time check on exceeding the valid number of arguments. *) the return type shouldn't be "void" but an N-nargs (N minus args.length) dimensional array. Since N is a template parameter, each function must return a different type.thx -manfred
Oct 14 2007