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 ) ) {
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);
}
}
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
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
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.
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
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
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
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
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
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
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
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
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).
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
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
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
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
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
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
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
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
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:
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
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
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
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.
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
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
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'
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
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
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
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
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
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
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
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
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
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
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
>>>
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
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
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
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
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
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
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-
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
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
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
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
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)
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
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
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
A simple command line spell checker would be a cool demonstration of this!
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
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
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
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.
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
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
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
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
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
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
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
在 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
在 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
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,
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
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
在 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
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
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
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
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
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
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'
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 - 100 of 230 matches
Mail list logo