Re: Fully dynamic d by opDotExp overloading

2009-11-28 Thread Walter Bright
Simen kjaeraas wrote: Just tested it - it does not seem to allow template parameters beyond just the function name. Is this something we can expect in the future? The use case I have is this: struct foo { void opDispatch( string name, T )( T value ) { static if ( is( T == float ) ) {

Re: Fully dynamic d by opDotExp overloading

2009-11-28 Thread Walter Bright
bearophile wrote: Can someone show me a small example of how to use it with runtime method names? class C { void dynamic(string s, int i) { ... } void opDispatch(string s)(int i) { dynamic(s, i); } }

Re: Fully dynamic d by opDotExp overloading

2009-11-28 Thread Simen kjaeraas
On Sun, 29 Nov 2009 00:37:34 +0100, Walter Bright wrote: davidl wrote: Any comments? Do you like this feature? And here it is (called opDispatch, Michel Fortin's suggestion): http://www.dsource.org/projects/dmd/changeset?new=trunk%2f...@268&old=trunk%2f...@267 Just tested it - it does n

Re: Fully dynamic d by opDotExp overloading

2009-11-28 Thread bearophile
Walter Bright: > opDispatch can be written to do runtime method names, no language > changes needed. Very good. Then the opDynamic name wasn't wrong. Can someone show me a small example of how to use it with runtime method names? Bye, bearophile

Re: Fully dynamic d by opDotExp overloading

2009-11-28 Thread Walter Bright
bearophile wrote: Walter Bright: And here it is (called opDispatch, Michel Fortin's suggestion):< That's short code. Do you like my related suggestion of opDynamic (that works with run-time method names)? opDispatch can be written to do runtime method names, no language changes needed.

Re: Fully dynamic d by opDotExp overloading

2009-11-28 Thread bearophile
Walter Bright: > And here it is (called opDispatch, Michel Fortin's suggestion):< That's short code. Do you like my related suggestion of opDynamic (that works with run-time method names)? Bye, bearophile

Re: Fully dynamic d by opDotExp overloading

2009-11-28 Thread Walter Bright
davidl wrote: Any comments? Do you like this feature? And here it is (called opDispatch, Michel Fortin's suggestion): http://www.dsource.org/projects/dmd/changeset?new=trunk%2f...@268&old=trunk%2f...@267

Re: Fully dynamic d by opDotExp overloading

2009-04-27 Thread Benji Smith
Danny Wilson wrote: Now let's go from that obvious observation to opDotExp() You know the class uses opDotExp() because it said so in the docs. Examples that could really benifit from this are: - XMLRPC and other kinds of remoting - Quick access to: XML / JSON / Yaml / Config files / DB access

Re: Fully dynamic d by opDotExp overloading

2009-04-20 Thread Christopher Wright
Michel Fortin wrote: On 2009-04-20 07:25:43 -0400, Christopher Wright said: BCS wrote: Hello Christopher, The utility is when you are looking for methods to invoke via runtime reflection, you can determine that a given function is one of these runtime opDotExp equivalents. So it is being

Re: Fully dynamic d by opDotExp overloading

2009-04-20 Thread Andrei Alexandrescu
Andrei Alexandrescu wrote: Steven Schveighoffer wrote: Haven't used D2 for much stuff, but does this work? I remember reading something about partial IFTI, so if you have opDotExp(string fname, T...) (T args){} and you call opDotExp!("b")(c, d, e) Does it implicitly define T? -Steve It

Re: Fully dynamic d by opDotExp overloading

2009-04-20 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: Haven't used D2 for much stuff, but does this work? I remember reading something about partial IFTI, so if you have opDotExp(string fname, T...) (T args){} and you call opDotExp!("b")(c, d, e) Does it implicitly define T? -Steve It should, but there's a bug re

Re: Fully dynamic d by opDotExp overloading

2009-04-20 Thread Michel Fortin
On 2009-04-20 07:25:43 -0400, Christopher Wright said: BCS wrote: Hello Christopher, The utility is when you are looking for methods to invoke via runtime reflection, you can determine that a given function is one of these runtime opDotExp equivalents. So it is being argued that there shou

Re: Fully dynamic d by opDotExp overloading

2009-04-20 Thread Steven Schveighoffer
On Mon, 20 Apr 2009 09:47:53 -0400, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: On Mon, 20 Apr 2009 06:54:21 -0400, Denis Koroskin <2kor...@gmail.com> wrote: On Mon, 20 Apr 2009 06:09:28 +0400, Steven Schveighoffer wrote: Yes, there are many things that opDotExp can do tha

Re: Fully dynamic d by opDotExp overloading

2009-04-20 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Mon, 20 Apr 2009 06:54:21 -0400, Denis Koroskin <2kor...@gmail.com> wrote: On Mon, 20 Apr 2009 06:09:28 +0400, Steven Schveighoffer wrote: Yes, there are many things that opDotExp can do that opDot or alias this (which is essentially opDot without any code).

Re: Fully dynamic d by opDotExp overloading

2009-04-20 Thread Steven Schveighoffer
On Mon, 20 Apr 2009 06:54:21 -0400, Denis Koroskin <2kor...@gmail.com> wrote: On Mon, 20 Apr 2009 06:09:28 +0400, Steven Schveighoffer wrote: Yes, there are many things that opDotExp can do that opDot or alias this (which is essentially opDot without any code). Hooking every function

Re: Fully dynamic d by opDotExp overloading

2009-04-20 Thread Christopher Wright
BCS wrote: Hello Christopher, The utility is when you are looking for methods to invoke via runtime reflection, you can determine that a given function is one of these runtime opDotExp equivalents. So it is being argued that there should be a standard way to do a run time function invocation

Re: Fully dynamic d by opDotExp overloading

2009-04-20 Thread Denis Koroskin
On Mon, 20 Apr 2009 06:09:28 +0400, Steven Schveighoffer wrote: Yes, there are many things that opDotExp can do that opDot or alias this (which is essentially opDot without any code). Hooking every function call on a type seems to be one of the two killer use cases of this feature (the o

Re: Fully dynamic d by opDotExp overloading

2009-04-20 Thread BCS
Hello Yigal, I was meaning static as in "static if". I agree with what you've written here. I think my point in this sub-thread is a bit side-tracked from the main topic. there seems to be a lot of that in this thread again, what you said is correct, but since in our example we are discussin

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Yigal Chripun
On 20/04/2009 01:13, BCS wrote: Hello Yigal, everything you said is true. there is some sort of a compile-time since the code is getting compiled. But in the above scheme there isn't any real difference between run-time and compile-time and this distinction has lost its meaning. compare the fol

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread BCS
Hello Steven, Also, I don't think the requirement for this feature needs to be for the arguments to be templated, it should be sufficient to have a single string template argument. This way, you can overload opDotExp functions via argument lists. split the difference and allow either (but

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread BCS
Hello Christopher, The utility is when you are looking for methods to invoke via runtime reflection, you can determine that a given function is one of these runtime opDotExp equivalents. So it is being argued that there should be a standard way to do a run time function invocation system? I'l

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread BCS
Hello BCS, That didn't sound like I intended it to so... Clarification: I think most of us could convince most of the rest of us of the our point given face time because I don't think there are near as many opposing views as it seems. (That is with points of operation, not with issues of synt

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Steven Schveighoffer
On Sun, 19 Apr 2009 10:42:19 -0400, Denis Koroskin <2kor...@gmail.com> wrote: On Sun, 19 Apr 2009 18:26:11 +0400, Steven Schveighoffer wrote: On Sun, 19 Apr 2009 06:26:57 -0400, Denis Koroskin <2kor...@gmail.com> wrote: On Sun, 19 Apr 2009 05:40:32 +0400, Steven Schveighoffer wrote:

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Michel Fortin
Andrei Alexandrescu wrote: Christopher Wright wrote: Andrei Alexandrescu wrote: You completely lost me about the necessity of a standardized catch-all function. My view is that if you want to forward to someone else, you just call the runtime invoke() for the guy you want to forward to. So

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread BCS
Hello Adam, BCS wrote: (In the above, you seeme to be working with the assumption of the non static opDotExp form. I, BTW, see no use for it as it adds no new functionality to D where as the static opDotExp(char[],T...)(T t) form adds a new ability) When you say static opDotExp I am assuming

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Andrei Alexandrescu
Christopher Wright wrote: Andrei Alexandrescu wrote: Michel Fortin wrote: On 2009-04-18 22:21:50 -0400, Andrei Alexandrescu said: I did, but sorry, it doesn't make sense and does nothing but continue the terrible confusion going in this thread. Then let's try to remove some of that confus

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Christopher Wright
Andrei Alexandrescu wrote: Michel Fortin wrote: On 2009-04-18 22:21:50 -0400, Andrei Alexandrescu said: I did, but sorry, it doesn't make sense and does nothing but continue the terrible confusion going in this thread. Then let's try to remove some of that confusion. Thanks for doing so.

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Adam Burton
BCS wrote: > Hello Adam, > >> BCS wrote: >> >>> Hello Adam, >>> On Sat, Apr 18, 2009 at 06:10:27PM -0700, Andrei Alexandrescu wrote: > The point of using "." is not syntactic convenience as much as the > ability of the Dynamic structure to work out of the box with > algor

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread BCS
Hello Yigal, everything you said is true. there is some sort of a compile-time since the code is getting compiled. But in the above scheme there isn't any real difference between run-time and compile-time and this distinction has lost its meaning. compare the following: process A: 1) use runtime

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Yigal Chripun
On 19/04/2009 23:33, BCS wrote: Hello Yigal, On 19/04/2009 01:22, BCS wrote: Hello Yigal, On 18/04/2009 21:16, Andrei Alexandrescu wrote: In the syntax a.b how would either of a and b be identified at runtime? I mean, you write the code somewhere and it gets compiled. It's not like you'

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread BCS
Hello Yigal, On 19/04/2009 01:22, BCS wrote: Hello Yigal, On 18/04/2009 21:16, Andrei Alexandrescu wrote: In the syntax a.b how would either of a and b be identified at runtime? I mean, you write the code somewhere and it gets compiled. It's not like you're reading "a.b" from the console

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread BCS
Hello Adam, BCS wrote: Hello Adam, On Sat, Apr 18, 2009 at 06:10:27PM -0700, Andrei Alexandrescu wrote: The point of using "." is not syntactic convenience as much as the ability of the Dynamic structure to work out of the box with algorithms that use the standard notation. What if the d

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Andrei Alexandrescu
Michel Fortin wrote: On 2009-04-18 22:21:50 -0400, Andrei Alexandrescu said: I did, but sorry, it doesn't make sense and does nothing but continue the terrible confusion going in this thread. Then let's try to remove some of that confusion. Thanks for doing so. Given that my wits are spen

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Christopher Wright
Michel Fortin wrote: The thing is that the name of that "catchAllHandlerFunc" function needs to be standardised for it to work with runtime reflection. I agree with this wholeheartedly. However, opDotExp would be hamstringed if it were made to serve this function. Since classes can implemen

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Denis Koroskin
On Sun, 19 Apr 2009 18:26:11 +0400, Steven Schveighoffer wrote: On Sun, 19 Apr 2009 06:26:57 -0400, Denis Koroskin <2kor...@gmail.com> wrote: On Sun, 19 Apr 2009 05:40:32 +0400, Steven Schveighoffer wrote: On Sat, 18 Apr 2009 21:10:27 -0400, Andrei Alexandrescu wrote: Adam Burton

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Steven Schveighoffer
On Sun, 19 Apr 2009 10:26:11 -0400, Steven Schveighoffer wrote: On Sun, 19 Apr 2009 06:26:57 -0400, Denis Koroskin <2kor...@gmail.com> wrote: On Sun, 19 Apr 2009 05:40:32 +0400, Steven Schveighoffer wrote: On Sat, 18 Apr 2009 21:10:27 -0400, Andrei Alexandrescu wrote: Adam Burto

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Steven Schveighoffer
On Sun, 19 Apr 2009 06:26:57 -0400, Denis Koroskin <2kor...@gmail.com> wrote: On Sun, 19 Apr 2009 05:40:32 +0400, Steven Schveighoffer wrote: On Sat, 18 Apr 2009 21:10:27 -0400, Andrei Alexandrescu wrote: Adam Burton wrote: Andrei Alexandrescu wrote: What about using something like

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Steven Schveighoffer
On Sun, 19 Apr 2009 02:00:50 -0400, Don wrote: Steven Schveighoffer wrote: Yeah, I get that it can be done manually. What I'm suggesting is that the compiler makes sure the static assert occurs if thbe result of compiling the template instance results in an empty function. I look at it

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Adam Burton
Adam Burton wrote: > BCS wrote: > >> Hello Adam, >> >>> On Sat, Apr 18, 2009 at 06:10:27PM -0700, Andrei Alexandrescu wrote: >>> The point of using "." is not syntactic convenience as much as the ability of the Dynamic structure to work out of the box with algorithms that use the

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Michel Fortin
On 2009-04-18 22:21:50 -0400, Andrei Alexandrescu said: I did, but sorry, it doesn't make sense and does nothing but continue the terrible confusion going in this thread. Then let's try to remove some of that confusion. You say: well if opDot were a template then a scripting language can't

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Adam Burton
Denis Koroskin wrote: > On Sun, 19 Apr 2009 05:40:32 +0400, Steven Schveighoffer > wrote: > >> On Sat, 18 Apr 2009 21:10:27 -0400, Andrei Alexandrescu >> wrote: >> >>> Adam Burton wrote: Andrei Alexandrescu wrote: >> What about using something like '->' for dynamic calls instead of >>>

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Adam Burton
BCS wrote: > Hello Adam, > >> On Sat, Apr 18, 2009 at 06:10:27PM -0700, Andrei Alexandrescu wrote: >> >>> The point of using "." is not syntactic convenience as much as the >>> ability of the Dynamic structure to work out of the box with >>> algorithms that use the standard notation. >>> >> Wha

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Simen Kjaeraas
Adam Burton wrote: What about using something like '->' for dynamic calls instead of '.'? When you see '.' your safe in the knowledge that at a glance you know said method with said signature exists else the compiler will throw a paddy, when you see '->' you know that method call is evaluate

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Denis Koroskin
On Sun, 19 Apr 2009 05:40:32 +0400, Steven Schveighoffer wrote: On Sat, 18 Apr 2009 21:10:27 -0400, Andrei Alexandrescu wrote: Adam Burton wrote: Andrei Alexandrescu wrote: What about using something like '->' for dynamic calls instead of '.'? That's absolutely useless. If I have to w

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread downs
Daniel Keep wrote: > > bearophile wrote: >> downs: >>> bearophile: But a static foreach (on a static data structure that has opApply) is not doable yet, I think. >>> Foreach on a tuple is evaluated at compile-time. >> Yes, that's the whole point of that Range!(). >> But you can't use th

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Don
Steven Schveighoffer wrote: On Sat, 18 Apr 2009 14:05:30 -0400, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: I gave this a lot of thought, and I think here is a possible solution: the main reason I'm hesitant on this idea is because of code like this: class X { auto opDotExp(st

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Yigal Chripun
On 19/04/2009 01:22, BCS wrote: Hello Yigal, On 18/04/2009 21:16, Andrei Alexandrescu wrote: In the syntax a.b how would either of a and b be identified at runtime? I mean, you write the code somewhere and it gets compiled. It's not like you're reading "a.b" from the console and then call s

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Georg Wrede
Walter Bright wrote: A simple command line spell checker would be a cool demonstration of this! $ man bash /cdspell If set, minor errors in the spelling of a directory com- ponent in a cd command will be corrected. The errors checked for are transposed characters, a missing charac-

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread BCS
Hello Michel, On 2009-04-18 17:48:33 -0400, Andrei Alexandrescu said: Michel Fortin wrote: On 2009-04-18 11:19:38 -0400, Andrei Alexandrescu said: I'm confused. Isn't it clear that at the moment we "have" the ability to pass a function name as a runtime string? Indeed, you can pass the

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread BCS
Hello Adam, On Sat, Apr 18, 2009 at 06:10:27PM -0700, Andrei Alexandrescu wrote: The point of using "." is not syntactic convenience as much as the ability of the Dynamic structure to work out of the box with algorithms that use the standard notation. What if the dot remained exactly like it

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
Michel Fortin wrote: On 2009-04-18 17:48:33 -0400, Andrei Alexandrescu said: Michel Fortin wrote: On 2009-04-18 11:19:38 -0400, Andrei Alexandrescu said: I'm confused. Isn't it clear that at the moment we "have" the ability to pass a function name as a runtime string? Indeed, you can p

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Steven Schveighoffer
On Sat, 18 Apr 2009 21:10:27 -0400, Andrei Alexandrescu wrote: Adam Burton wrote: Andrei Alexandrescu wrote: What about using something like '->' for dynamic calls instead of '.'? That's absolutely useless. If I have to write anything different from "." I might as well write "bloodyMaryBlo

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Steven Schveighoffer
On Sat, 18 Apr 2009 14:05:30 -0400, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: I gave this a lot of thought, and I think here is a possible solution: the main reason I'm hesitant on this idea is because of code like this: class X { auto opDotExp(string fname, T...)(T args)

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Michel Fortin
On 2009-04-18 17:48:33 -0400, Andrei Alexandrescu said: Michel Fortin wrote: On 2009-04-18 11:19:38 -0400, Andrei Alexandrescu said: I'm confused. Isn't it clear that at the moment we "have" the ability to pass a function name as a runtime string? Indeed, you can pass the template argum

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Adam D. Ruppe
On Sat, Apr 18, 2009 at 06:10:27PM -0700, Andrei Alexandrescu wrote: > The point of using "." is not syntactic convenience as much as the > ability of the Dynamic structure to work out of the box with algorithms > that use the standard notation. What if the dot remained exactly like it is now an

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
Adam Burton wrote: Andrei Alexandrescu wrote: What about using something like '->' for dynamic calls instead of '.'? That's absolutely useless. If I have to write anything different from "." I might as well write "bloodyMaryBloodyMaryBloodyMary". Andrei You could even write 'noodles' but that

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Walter Bright
A simple command line spell checker would be a cool demonstration of this!

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Adam Burton
Andrei Alexandrescu wrote: > Adam Burton wrote: >> Jason House wrote: >> >>> Andrei Alexandrescu Wrote: >>> Nick Sabalausky wrote: > Please do not accuse me of such a thing simply because I haven't > changed my opinion. You've held your ground as well, so I could just > as easily

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Christopher Wright
bearophile wrote: Andrei Alexandrescu: Yes. The amount of confusion in this thread is staggering. I think I have misunderstood about the whole thread then. If the string isn't determined at run time, then this thing isn't useful for my purposes, and it's not close to the object-C as I was ta

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Simen Kjaeraas
Yigal Chripun wrote: what prevents D from having an eval function? suppose someone modifies the DMD front-end to compile a string with the source code of a function in-memory, than this is processed by something based on DDL and what you get is an API call that takes source code in a strin

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread BCS
Hello Yigal, On 18/04/2009 21:16, Andrei Alexandrescu wrote: In the syntax a.b how would either of a and b be identified at runtime? I mean, you write the code somewhere and it gets compiled. It's not like you're reading "a.b" from the console and then call some eval() function against them.

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
davidl wrote: 在 Sun, 19 Apr 2009 03:15:02 +0800,Daniel Keep 写道: Andrei Alexandrescu wrote: Michel Fortin wrote: ... Andrei, I think you, and perhaps everyone here, are overlooking one small but important detail. opDotExp, if a template like you're adovcating, undermines future runtime d

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
Adam Burton wrote: Jason House wrote: Andrei Alexandrescu Wrote: Nick Sabalausky wrote: Please do not accuse me of such a thing simply because I haven't changed my opinion. You've held your ground as well, so I could just as easily accuse you of being closed-minded and merely reaffirming a y

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
Yigal Chripun wrote: On 18/04/2009 21:16, Andrei Alexandrescu wrote: bearophile wrote: Andrei Alexandrescu: Yes. The amount of confusion in this thread is staggering. I think I have misunderstood about the whole thread then. If the string isn't determined at run time, then this thing isn't u

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
Michel Fortin wrote: On 2009-04-18 11:19:38 -0400, Andrei Alexandrescu said: I'm confused. Isn't it clear that at the moment we "have" the ability to pass a function name as a runtime string? Indeed, you can pass the template argument as a runtime argument to another function. No misunders

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
davidl wrote: 在 Sun, 19 Apr 2009 02:16:30 +0800,Andrei Alexandrescu 写道: bearophile wrote: Andrei Alexandrescu: Yes. The amount of confusion in this thread is staggering. I think I have misunderstood about the whole thread then. If the string isn't determined at run time, then this thing i

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Denis Koroskin
On Sat, 18 Apr 2009 21:43:15 +0400, Steven Schveighoffer wrote: On Fri, 17 Apr 2009 23:43:22 -0400, Steven Schveighoffer wrote: On Fri, 17 Apr 2009 21:54:52 -0400, Steven Schveighoffer wrote: Andrei wrote: We are discussing a language extension. That language extension will allow a

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Don
Michel Fortin wrote: On 2009-04-18 11:19:38 -0400, Andrei Alexandrescu said: I'm confused. Isn't it clear that at the moment we "have" the ability to pass a function name as a runtime string? Indeed, you can pass the template argument as a runtime argument to another function. No misunders

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread davidl
在 Sun, 19 Apr 2009 03:42:02 +0800,Michel Fortin 写道: On 2009-04-18 11:19:38 -0400, Andrei Alexandrescu said: I'm confused. Isn't it clear that at the moment we "have" the ability to pass a function name as a runtime string? Indeed, you can pass the template argument as a runtime argume

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread davidl
在 Sun, 19 Apr 2009 03:15:02 +0800,Daniel Keep 写道: Andrei Alexandrescu wrote: Michel Fortin wrote: ... Andrei, I think you, and perhaps everyone here, are overlooking one small but important detail. opDotExp, if a template like you're adovcating, undermines future runtime dynamic call ca

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Yigal Chripun
On 18/04/2009 21:16, Andrei Alexandrescu wrote: bearophile wrote: Andrei Alexandrescu: Yes. The amount of confusion in this thread is staggering. I think I have misunderstood about the whole thread then. If the string isn't determined at run time, then this thing isn't useful for my purposes,

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Adam Burton
Jason House wrote: > Andrei Alexandrescu Wrote: > >> Nick Sabalausky wrote: >> > Please do not accuse me of such a thing simply because I haven't >> > changed my opinion. You've held your ground as well, so I could just as >> > easily accuse you of being closed-minded and merely reaffirming a you

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Michel Fortin
On 2009-04-18 11:19:38 -0400, Andrei Alexandrescu said: I'm confused. Isn't it clear that at the moment we "have" the ability to pass a function name as a runtime string? Indeed, you can pass the template argument as a runtime argument to another function. No misunderstanding here. What

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread davidl
在 Sun, 19 Apr 2009 02:16:30 +0800,Andrei Alexandrescu 写道: bearophile wrote: Andrei Alexandrescu: Yes. The amount of confusion in this thread is staggering. I think I have misunderstood about the whole thread then. If the string isn't determined at run time, then this thing isn't useful f

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Daniel Keep
Andrei Alexandrescu wrote: > Michel Fortin wrote: >> ... >> >> Andrei, I think you, and perhaps everyone here, are overlooking one >> small but important detail. >> >> opDotExp, if a template like you're adovcating, undermines future >> runtime dynamic call capabilities (which are part of most ru

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Daniel Keep
bearophile wrote: > downs: >> bearophile: >>> But a static foreach (on a static data structure that has opApply) is not >>> doable yet, I think. >> Foreach on a tuple is evaluated at compile-time. > > Yes, that's the whole point of that Range!(). > But you can't use that trick on an associative

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
Walter Bright wrote: Andrei Alexandrescu wrote: Daniel Keep wrote: There's an interesting idea... Instead of "No member 'foo'", you could have "No member 'foo'; did you mean 'far' or 'fur'?" Heh. The string kernels in std.numeric (http://erdani.dreamhosters.com/d/web/phobos/std_numeric.html

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Walter Bright
Andrei Alexandrescu wrote: Daniel Keep wrote: There's an interesting idea... Instead of "No member 'foo'", you could have "No member 'foo'; did you mean 'far' or 'fur'?" Heh. The string kernels in std.numeric (http://erdani.dreamhosters.com/d/web/phobos/std_numeric.html) are to help with ex

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
bearophile wrote: Andrei Alexandrescu: Yes. The amount of confusion in this thread is staggering. I think I have misunderstood about the whole thread then. If the string isn't determined at run time, then this thing isn't useful for my purposes, and it's not close to the object-C as I was ta

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread bearophile
Andrei Alexandrescu: > Yes. The amount of confusion in this thread is staggering. I think I have misunderstood about the whole thread then. If the string isn't determined at run time, then this thing isn't useful for my purposes, and it's not close to the object-C as I was talking about, and it'

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: I gave this a lot of thought, and I think here is a possible solution: the main reason I'm hesitant on this idea is because of code like this: class X { auto opDotExp(string fname, T...)(T args) { if(fname == "blah") return foo(args); else if(fna

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
Don wrote: I don't see _anything_ dynamic in this proposal, actually. Yes. The amount of confusion in this thread is staggering. I think the right question to ask is, "what does opDotExp bring, that wasn't there before?" Is it reflection of any kind? No. Is it the ability to encode operati

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Steven Schveighoffer
On Fri, 17 Apr 2009 23:43:22 -0400, Steven Schveighoffer wrote: On Fri, 17 Apr 2009 21:54:52 -0400, Steven Schveighoffer wrote: Andrei wrote: We are discussing a language extension. That language extension will allow a type to choose flexibility in defining methods dynamically, while

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread BCS
Hello Denis, On Sat, 18 Apr 2009 19:46:36 +0400, BCS wrote: not exactly 1-to-1 but: Bad example: So I saw, I'm just saying it's not without precedent.

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread BCS
Hello Christopher, Testing the logic of your code will catch the latter error and not the former. But the former isn't an error, if it has the same result. IIRC dynamic language do gobs of TDD/unittests because they have no choice for just this reason. Any other approach and you have no clu

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Denis Koroskin
On Sat, 18 Apr 2009 19:46:36 +0400, BCS wrote: Hello Andrei, The dynamic behavior is indicated by the use of opDotExp. The redundancy of the two notations doesn't quite sit well. Andrei not exactly 1-to-1 but: abstract class C { void foo(); } // works class D { void foo(); } // fails: l

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread BCS
Hello Andrei, The dynamic behavior is indicated by the use of opDotExp. The redundancy of the two notations doesn't quite sit well. Andrei not exactly 1-to-1 but: abstract class C { void foo(); } // works class D { void foo(); } // fails: link error

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread BCS
Hello bearophile, Andrei Alexandrescu: I know, but at about the fiftienth one you get sick of it. In some situations static loops can be useful, but in general isn't the compiler supposed to be able to perform loop unrolling by itself, according to compilation arguments and according to how

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Don
bearophile wrote: SandeepK: I too am having difficulty in understanding the benefit of this particular proposal. Read the thread, some of the answers give several use cases. If I understand it right, the string essentially is still static and hence known at compile time?< It can be unkn

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Leandro Lucarella
Daniel Keep, el 18 de abril a las 19:08 me escribiste: > > So I have created this, that I actually use in a large Graph class of mine > > that has many methods: > > http://code.activestate.com/recipes/409000/ > > Such class can be used from the interactive shell too, to play with graphs > > in an

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread bearophile
Andrei Alexandrescu: > I know, but at about the fiftienth one you get sick of it. In some situations static loops can be useful, but in general isn't the compiler supposed to be able to perform loop unrolling by itself, according to compilation arguments and according to how much code is present

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
Michel Fortin wrote: On 2009-04-18 03:23:21 -0400, Andrei Alexandrescu said: If you want to invoke a method known as a string variable, opDot or whatever has nothing to do with it. You don't need any change to the language at all, because you'd write: string foo = "bar"; d.call(foo); // ca

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
downs wrote: Static loops are simple, at least in functions. import std.stdio; template Tuple(T...) { alias T Tuple; } template Repeat(T, int I) { static if (!I) alias Tuple!() Repeat; else alias Tuple!(T, Repeat!(T, I-1)) Repeat; } void main() { foreach (i, bogus; Repeat!(void, 15)) wr

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
Daniel Keep wrote: bearophile wrote: Andrei Alexandrescu: Pascalize!S s; s.foo(); // works s.Foo(); // works too s.fOo(); // yup, works again I can show something even more extreme :-) What we are discussing in this thread is named the __getattr__ method in Python: http://docs.python.org/ref

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread bearophile
SandeepK: > I too am having difficulty in understanding the benefit of this particular > proposal. Read the thread, some of the answers give several use cases. >If I understand it right, the string essentially is still static and hence >known at compile time?< It can be unknown at compile-tim

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread SandeepK
Leandro Lucarella Wrote: > > So now, let's try this again: > > What is this usefulness you speak of that traditional dynamic methods > > and/or > > opDotSrc dynamic methods have that is more useful than a dispatch method? > > Uniform (and better) syntax. It's just about that. I too am having

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Leandro Lucarella
Nick Sabalausky, el 18 de abril a las 02:19 me escribiste: > "Leandro Lucarella" wrote in message > news:20090417231958.gb27...@homero.springfield.home... > > Nick Sabalausky, el 17 de abril a las 16:48 me escribiste: > >> "Leandro Lucarella" wrote in message > >> news:20090417191634.ga15...@ho

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Christopher Wright
Daniel Keep wrote: Cool! I suggest the rewrite: c.unknownmethod(args) -> c.opDotExp!("unknownmethod")(args) That way you have the option of handling the method name statically or dynamically. Careful. If you do that, you need to make sure it's possible to invoke a given method at runtime. A

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Christopher Wright
Nick Sabalausky wrote: "Christopher Wright" wrote in message news:gsb05g$2in...@digitalmars.com... Assuming that you are testing the logic of your application, you will trivially check things like accessing "legnth" rather than "length" -- under the assumption that these two methods would do d

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Christopher Wright
Don wrote: Steven Schveighoffer wrote: On Fri, 17 Apr 2009 21:54:52 -0400, Steven Schveighoffer wrote: Andrei wrote: We are discussing a language extension. That language extension will allow a type to choose flexibility in defining methods dynamically, while being otherwise integrated syn

  1   2   3   >