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
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
KennyTM~ wrote:
On Nov 28, 09 22:00, bearophile wrote:
Walter Bright:
and then s.foo(3), if foo is not a compile time member of s, is
rewritten as:
s.opDynamic!("foo")(3);
I don't understand, isn't this the right translation?
s.opDynamic("foo", 3);
If the "foo" name is known at compile t
retard wrote:
Is this again one of those features that is supposed to hide the fact
that dmd & optlink toolchain sucks? At least gcc can optimize the calls
in most cases where the operator is defined to be virtual, but is used in
non-polymorphic manner.
The gnu linker (ld) does not do any opt
Denis Koroskin wrote:
I thought operator overloading was going to be implemented via
templates. As such, they are non-virtual by default, which is okay, in
my opinion.
Yes, that's the rationale. I'm looking for a hole in it.
On Sat, 28 Nov 2009 23:28:51 +0300, l8night wrote:
Too many bugs - no way my superiors allow some program with that bug
list and the open date for version 2. worst is the slow bugfixes.
What bugs are you talking about? Mark it as a blocker if that's a known
one, or submit a bugreport if it
Too many bugs - no way my superiors allow some program with that bug list and
the open date for version 2. worst is the slow bugfixes.
On Sat, 28 Nov 2009 22:03:07 +0300, Walter Bright
wrote:
Michael P. wrote:
http://ftp.digitalmars.com/dmd.1.044.zip
seems to be dead.
There isn't one with that version.
There is one in changelog:
http://www.digitalmars.com/d/1.0/changelog.html#new1_044
Michael P. wrote:
http://ftp.digitalmars.com/dmd.1.044.zip
seems to be dead.
There isn't one with that version.
http://ftp.digitalmars.com/dmd.1.044.zip
seems to be dead.
Fri, 27 Nov 2009 14:10:34 +0100, Danny Wilson wrote:
> Op Fri, 27 Nov 2009 11:58:59 +0100 schreef Don :
>
>>> void foo()
>>> @naked body
>>> {
>>
>> LOL! Spam filters would love that!!
>
> I can already imagine the jokes spreading over the internets:
>
> @safe public double penetration(of a) @n
Trass3r wrote:
I like to use a "R.I.P. C++" D signature in forums, but it would be much
cooler if I had a fancy banner for that with a gravestone etc., is there
something like that or is there somebody here in the community who could
create one? :)
Oh, please. I'd love to put one up on The On
I like to use a "R.I.P. C++" D signature in forums, but it would be much
cooler if I had a fancy banner for that with a gravestone etc., is there
something like that or is there somebody here in the community who could
create one? :)
On Nov 28, 09 16:16, l8night wrote:
hi walter,
when will the next bugfix version be released?
You could always use the svn version.
On Nov 28, 09 22:00, bearophile wrote:
Walter Bright:
and then s.foo(3), if foo is not a compile time member of s, is
rewritten as:
s.opDynamic!("foo")(3);
I don't understand, isn't this the right translation?
s.opDynamic("foo", 3);
If the "foo" name is known at compile time only (as in a
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
dsimcha wrote:
> == Quote from Walter Bright (newshou...@digitalmars.com)'s article
>> dsimcha wrote:
>>> Sometimes I feel like there should be a law similar to Greenspun's Law for
>
> Having never done it before, I really cannot imagine how people ge
> It can have that signature shown by Walter:
> T opDispatch(s : string)(args...);
Or, to keep its name simpler to remember beside the opDynamic:
T opStatic(s : string)(args...);
Bye,
bearophile
Don:
> You mean, if it's known at run-time only?
Yes, sorry.
> What Walter has written is definitely the correct one.
I am not saying that what Walter has written is wrong or useless :-)
I am saying that it's not dynamic. This means that:
1) The name of that operator "opDynamic" is wrong, it nee
Lutger wrote:
I tend to think attributes in .NET are a regular means of abstraction, much
like classes or generics. In part, they make up for lack of other
metaprogramming features in some .NET languages.
I agree; I think they are best for associating arbitrary information
with arbitrary type
== Quote from retard (r...@tard.com.invalid)'s article
> Sat, 28 Nov 2009 08:16:33 -0500, bearophile wrote:
> > dsimcha:
> >> but it would introduce an
> >> inconsistency into the language relative to "regular" methods.
> >
> > Right, it's an exception to a rule of the language, so it increases the
bearophile wrote:
Walter Bright:
and then s.foo(3), if foo is not a compile time member of s, is
rewritten as:
s.opDynamic!("foo")(3);
I don't understand, isn't this the right translation?
s.opDynamic("foo", 3);
If the "foo" name is known at compile time only (as in all C# examples and in
Sat, 28 Nov 2009 08:16:33 -0500, bearophile wrote:
> dsimcha:
>> but it would introduce an
>> inconsistency into the language relative to "regular" methods.
>
> Right, it's an exception to a rule of the language, so it increases the
> language complexity.
I guess the systems programming language
bearophile:
> If the "foo" name is known at compile time only
I meant at "run-time only", that's what defines it as dynamic. Otherwise, as
Michel Fortin says, there's nothing dynamic in it.
Bye,
bearophile
Walter Bright:
> and then s.foo(3), if foo is not a compile time member of s, is
> rewritten as:
> s.opDynamic!("foo")(3);
I don't understand, isn't this the right translation?
s.opDynamic("foo", 3);
If the "foo" name is known at compile time only (as in all C# examples and in
Python) you ca
On 2009-11-27 18:30:14 -0500, Walter Bright said:
But with a small feature, we can make this work:
struct S
{
...
T opDynamic(s : string)(args...);
}
and then s.foo(3), if foo is not a compile time member of s, is rewritten as:
s.opDynamic!("foo")(3);
and op
Stewart Gordon:
> Only for built-in linear arrays. Half the point is: What if somebody
> creates a type for which the lower bound is something different?
This can be useful. For example an array with indices in a .. z+1 :-)
> maybe we need some symbol like ^ to denote the lower
> bound, and o
dsimcha:
> but it would introduce an
> inconsistency into the language relative to "regular" methods.
Right, it's an exception to a rule of the language, so it increases the
language complexity.
Bye,
bearophile
On Sat, 28 Nov 2009 11:16:22 +0300, l8night wrote:
hi walter,
when will the next bugfix version be released?
Why would you ask? Any specific bug is blocking your development?
On Sat, 28 Nov 2009 10:16:33 +0300, Chris Nicholson-Sauls
wrote:
Walter Bright wrote:
One thing Java and Python, Ruby, etc., still hold over D is dynamic
classes, i.e. classes that are only known at runtime, not compile time.
In D, this:
s.foo(3);
could be emulated with:
s.dynam
Don wrote:
> Ary Borenszweig wrote:
>> Don wrote:
>>> #ponce wrote:
> Definitely. And what about @deprecated and @override?
As override is now required, i don't think it should be an attribute.
>>>
>>> As I understand it, one of the characteristics of attributes is that
>>> you shoul
hi walter,
when will the next bugfix version be released?
37 matches
Mail list logo