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...@268old=trunk%2f...@267

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
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: 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 Simen kjaeraas
On Sun, 29 Nov 2009 00:37:34 +0100, Walter Bright newshou...@digitalmars.com 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...@268old=trunk%2f...@267

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 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-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

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 discussing

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 schvei...@yahoo.com wrote: Yes, there are many things that opDotExp can do that opDot or alias this (which is essentially opDot without any code). Hooking

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 schvei...@yahoo.com wrote: Yes, there are many things that opDotExp can do that opDot or alias this (which is essentially opDot

Re: Fully dynamic d by opDotExp overloading

2009-04-20 Thread Steven Schveighoffer
On Mon, 20 Apr 2009 09:47:53 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org 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 schvei...@yahoo.com wrote: Yes,

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: 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 dhase...@gmail.com 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

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Don
Steven Schveighoffer wrote: On Sat, 18 Apr 2009 14:05:30 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org 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:

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Denis Koroskin
On Sun, 19 Apr 2009 05:40:32 +0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Sat, 18 Apr 2009 21:10:27 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org 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 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 evaluated

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. What if the dot remained

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 schvei...@yahoo.com wrote: On Sat, 18 Apr 2009 21:10:27 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Adam Burton wrote: Andrei Alexandrescu wrote: What about using something like '-' for

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Michel Fortin
On 2009-04-18 22:21:50 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org 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

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 schvei...@yahoo.com wrote: On Sat, 18 Apr 2009 21:10:27 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Adam Burton wrote: Andrei

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Steven Schveighoffer
On Sun, 19 Apr 2009 10:26:11 -0400, Steven Schveighoffer schvei...@yahoo.com 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 schvei...@yahoo.com wrote: On Sat, 18 Apr 2009 21:10:27 -0400, Andrei

Re: Fully dynamic d by opDotExp overloading

2009-04-19 Thread Denis Koroskin
On Sun, 19 Apr 2009 18:26:11 +0400, Steven Schveighoffer schvei...@yahoo.com 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 schvei...@yahoo.com wrote: On Sat, 18 Apr 2009 21:10:27 -0400, Andrei

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 implement

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 seewebsiteforem...@erdani.org 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

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

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

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

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 algorithms that use the standard

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 seewebsiteforem...@erdani.org 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

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

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 seewebsiteforem...@erdani.org 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

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 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 schvei...@yahoo.com 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

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

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Nick Sabalausky
Leandro Lucarella llu...@gmail.com wrote in message news:20090417231958.gb27...@homero.springfield.home... Nick Sabalausky, el 17 de abril a las 16:48 me escribiste: Leandro Lucarella llu...@gmail.com wrote in message news:20090417191634.ga15...@homero.springfield.home... Steven

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Nick Sabalausky
Don nos...@nospam.com wrote in message news:gsbovk$nb...@digitalmars.com... davidl wrote: ÔÚ Sat, 18 Apr 2009 03:45:43 +0800£¬Nick Sabalausky a...@a.a дµÀ: Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message news:gsak2p$1s8...@digitalmars.com... I think there's merit in

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Nick Sabalausky
Rainer Deyke rain...@eldwood.com wrote in message news:gsbodm$mj...@digitalmars.com... Nick Sabalausky wrote: But anyway, like I've said before, syntactic sugar is fine, but this is syntactic sugar that undermines the programmer's ability to rely on compile-time checking of class members. But

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Nick Sabalausky
Nick Sabalausky a...@a.a wrote in message news:gsbru0$rb...@digitalmars.com... Don nos...@nospam.com wrote in message news:gsbovk$nb...@digitalmars.com... The problem is a lack of notification at compile time. Runtime exceptions are the problem, not the solution. By the way, if the opDot

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread bearophile
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:

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Yigal Chripun
On 18/04/2009 04:54, Steven Schveighoffer wrote: I'm all for expanding runtime introspection that remains within the type system, I'm even for adding some possibility to create dynamically dispatched functions, as long as those functions are called differently from normal functions. -Steve

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
Nick Sabalausky wrote: Nick Sabalausky a...@a.a wrote in message news:gsbru0$rb...@digitalmars.com... Don nos...@nospam.com wrote in message news:gsbovk$nb...@digitalmars.com... The problem is a lack of notification at compile time. Runtime exceptions are the problem, not the solution. By

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Andrei Alexandrescu
Yigal Chripun wrote: On 18/04/2009 04:54, Steven Schveighoffer wrote: I'm all for expanding runtime introspection that remains within the type system, I'm even for adding some possibility to create dynamically dispatched functions, as long as those functions are called differently from normal

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Nick Sabalausky
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message news:gsav4n$2ij...@digitalmars.com... It's a good question. opDotExp leaves more flexibility because it allows for a host of compile-time manipulations, e.g. decide to forward to a member etc. Also consider this (probably

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Nick Sabalausky
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message news:gsbv56$13c...@digitalmars.com... I think there's a confusion somewhere. Are you sure you know what you don't like? :o) Over here it's 3:30 in the morning at the moment: I don't know a damn thing about anything right

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Daniel Keep
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:

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Danny Wilson
Op Sat, 18 Apr 2009 09:24:39 +0200 schreef Andrei Alexandrescu seewebsiteforem...@erdani.org: now you have an easy way to know if a type is dynamic without changing the method invocation syntax. A proper IDE can easily mark those Types as different, for example, using a different color.

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Danny Wilson
Op Fri, 17 Apr 2009 22:31:04 +0200 schreef Nick Sabalausky a...@a.a: But with opDotExp, its mere *existence* undermines my ability to be sure that non-quoted identifiers are ok as long as they've compiled. That type of tradeoff is obviously fine when the potential benefits are significant

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Simen Kjaeraas
Nick Sabalausky wrote: If the member-name parameter to opDotExp was *required* to be a template paramater, then I agree, and I would have no objections to having that. But it should be pointed out that that would not actually be dynamic invokation, since you wouldn't be able to invoke a

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Danny Wilson
Op Sat, 18 Apr 2009 12:25:55 +0200 schreef Danny Wilson blueze...@gmail.com: Op Fri, 17 Apr 2009 22:31:04 +0200 schreef Nick Sabalausky a...@a.a: so far, opDotExp's benefits are trivial at best. I don't want to have to keep track of ok, is this class using opDotExp or not, because if it

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread downs
Andrei Alexandrescu wrote: Denis Koroskin wrote: On Fri, 17 Apr 2009 18:24:04 +0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Fri, 17 Apr 2009 09:44:09 -0400, Leandro Lucarella llu...@gmail.com wrote: I don't fully understand the example though. In writefln((v.qq = 5).i), how

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread bearophile
downs: Static loops are simple, at least in functions. ... void main() { foreach (i, bogus; Repeat!(void, 15)) writefln(i); } My dlibs have: Range!([start], stop[, step]) with it I think your code becomes: void main() { foreach (i; Range!(15)) putr(i); } But a static

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread downs
bearophile wrote: downs: Static loops are simple, at least in functions. ... void main() { foreach (i, bogus; Repeat!(void, 15)) writefln(i); } My dlibs have: Range!([start], stop[, step]) with it I think your code becomes: void main() { foreach (i; Range!(15))

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread bearophile
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 array, or a struct with OpApply,

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Michel Fortin
On 2009-04-18 03:23:21 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org 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);

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Christopher Wright
Steven Schveighoffer wrote: On Fri, 17 Apr 2009 21:54:52 -0400, Steven Schveighoffer schvei...@yahoo.com 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

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 schvei...@yahoo.com 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

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Christopher Wright
Nick Sabalausky wrote: Christopher Wright dhase...@gmail.com 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

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.

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 llu...@gmail.com wrote in message news:20090417231958.gb27...@homero.springfield.home... Nick Sabalausky, el 17 de abril a las 16:48 me escribiste: Leandro Lucarella llu...@gmail.com wrote in message

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 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-time.

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:

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))

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 seewebsiteforem...@erdani.org 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

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 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 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 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 Denis Koroskin
On Sat, 18 Apr 2009 19:46:36 +0400, BCS n...@anon.com 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();

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

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread BCS
Hello Denis, On Sat, 18 Apr 2009 19:46:36 +0400, BCS n...@anon.com 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 Steven Schveighoffer
On Fri, 17 Apr 2009 23:43:22 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Fri, 17 Apr 2009 21:54:52 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: Andrei wrote: We are discussing a language extension. That language extension will allow a type to choose flexibility

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

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

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 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 array, or a

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 runtime

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread davidl
在 Sun, 19 Apr 2009 02:16:30 +0800,Andrei Alexandrescu seewebsiteforem...@erdani.org 写道: 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,

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 your

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Michel Fortin
On 2009-04-18 11:19:38 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org 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

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

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread davidl
在 Sun, 19 Apr 2009 03:15:02 +0800,Daniel Keep daniel.keep.li...@gmail.com 写道: 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

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 seewebsiteforem...@erdani.org 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

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Denis Koroskin
On Sat, 18 Apr 2009 21:43:15 +0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Fri, 17 Apr 2009 23:43:22 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Fri, 17 Apr 2009 21:54:52 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: Andrei wrote: We are discussing a

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 seewebsiteforem...@erdani.org 写道: 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

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 seewebsiteforem...@erdani.org 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

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

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

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

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 accuse you of being

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 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 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 and

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Michel Fortin
On 2009-04-18 17:48:33 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org said: Michel Fortin wrote: On 2009-04-18 11:19:38 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org said: I'm confused. Isn't it clear that at the moment we have the ability to pass a function name as a

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Steven Schveighoffer
On Sat, 18 Apr 2009 14:05:30 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org 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

Re: Fully dynamic d by opDotExp overloading

2009-04-18 Thread Steven Schveighoffer
On Sat, 18 Apr 2009 21:10:27 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org 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

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 seewebsiteforem...@erdani.org said: Michel Fortin wrote: On 2009-04-18 11:19:38 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org said: I'm confused. Isn't it clear that at the moment we have the ability to pass

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 BCS
Hello Michel, On 2009-04-18 17:48:33 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org said: Michel Fortin wrote: On 2009-04-18 11:19:38 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org said: I'm confused. Isn't it clear that at the moment we have the ability to pass a

  1   2   >