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
Leandro Lucarella wrote:
Don, el 18 de abril a las 23:43 me escribiste:
I don't understand why D even has finalizers. Can they do anything useful?
Yes. I use them to manage GPU memory/resources. Another are wrapper classes around manually allocated arrays (to avoid the false pointer problem with
dsimcha wrote:
I've started looking at implementing arbitrary sized Variant, and
I've hit a point where I need some opinions. The idea of
arbitrary sized Variant is to heap allocate when things get too
big to be stored inline in the VariantN struct. However, how
should copying a VariantN struct
Jason House wrote:
> Tango's GC (and therefore
> druntime's GC) has an explicit notification mechanism.
I guess I shouldn't have assumed that the features of tango became part of
druntime. I don't see any notification mechanism :(
The best design I've come up with is to make a helper class
we
I've started looking at implementing arbitrary sized Variant, and
I've hit a point where I need some opinions. The idea of
arbitrary sized Variant is to heap allocate when things get too
big to be stored inline in the VariantN struct. However, how
should copying a VariantN struct with the content
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
grauzone wrote:
This has happened before. Somehow Java has this penchant for
attracting odd groupies. Pretty much every feature that Java didn't
have was vilified by zealots until adoption, when all of a sudden it
became a brilliant decision.
D has this too.
Probably a lot of language enthu
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
Walter Bright wrote:
Leandro Lucarella wrote:
You missed the point. I'm not talking about freeing the memory. I'm
talking about finalizers. A finalizer could send a "bye" packet throgh
the
net. That can't be handled by the OS.
That shouldn't be handled by a finalizer. A "bye" packet can be h
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)
This has happened before. Somehow Java has this penchant for attracting
odd groupies. Pretty much every feature that Java didn't have was
vilified by zealots until adoption, when all of a sudden it became a
brilliant decision.
D has this too.
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
Edward Diener wrote:
Paul D. Anderson wrote:
Sounds like someone needs a strong dose of D!!
http://java.dzone.com/articles/why-java-doesnt-need-operator
The comments bounce between "operator overloading is always bad
because you can do idiotic things with it" and "operator overloading
is ess
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!
Leandro Lucarella wrote:
You missed the point. I'm not talking about freeing the memory. I'm
talking about finalizers. A finalizer could send a "bye" packet throgh the
net. That can't be handled by the OS.
That shouldn't be handled by a finalizer. A "bye" packet can be handled
by a static dest
Walter Bright Wrote:
> Leandro Lucarella wrote:
> > Close a connection gracefully for example, I guess (I mean, send a "bye"
> > packed, not just close the socket abruptly). Same for closing files
> > writing some mark or something. They can be risky when finalization is not
> > deterministic thou
Well, I guess it would be doable to guarantee destruction, but *only* if
order of destruction was not guaranteed.
In other words, at the end, the GC would not scan, it would just
destroy. Scanning is a problem, due to cycles and various other things,
but destroying all roots would be potentia
Unknown W. Brackets, el 18 de abril a las 16:16 me escribiste:
> The simple solution is this:
>
> 1. If your class object only involves memory, freed OS handles, etc., it
> should be used as-is. This is most class objects. Destructors are
> needed to clamp resource use (see File class.)
A File
Paul D. Anderson wrote:
Sounds like someone needs a strong dose of D!!
http://java.dzone.com/articles/why-java-doesnt-need-operator
The comments bounce between "operator overloading is always bad because you can do idiotic
things with it" and "operator overloading is essential because sometime
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
The simple solution is this:
1. If your class object only involves memory, freed OS handles, etc., it
should be used as-is. This is most class objects. Destructors are
needed to clamp resource use (see File class.)
2. If your class object involves hardware handles, transactional
assurance,
Leandro Lucarella, el 18 de abril a las 19:36 me escribiste:
> Rainer Deyke, el 18 de abril a las 16:18 me escribiste:
> > Leandro Lucarella wrote:
> > > You missed the point. I'm not talking about freeing the memory. I'm
> > > talking about finalizers. A finalizer could send a "bye" packet throgh
Rainer Deyke, el 18 de abril a las 16:18 me escribiste:
> Leandro Lucarella wrote:
> > You missed the point. I'm not talking about freeing the memory. I'm
> > talking about finalizers. A finalizer could send a "bye" packet throgh the
> > net. That can't be handled by the OS.
>
> It can't be handle
Don, el 18 de abril a las 23:43 me escribiste:
> >>I don't understand why D even has finalizers. Can they do anything useful?
> >Yes. I use them to manage GPU memory/resources. Another are wrapper classes
> >around manually allocated arrays (to avoid the false pointer problem with
> >very
> >lar
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.
Fawzi Mohamed, el 18 de abril a las 23:41 me escribiste:
> >>when the main thread ends other threads might be running, and removing
> >>memory they are using is not necessarily a good idea.
> >Then I guess gc_term() should be invoked when all threads have terminated.
> >Is there any technical diffi
Leandro Lucarella wrote:
> You missed the point. I'm not talking about freeing the memory. I'm
> talking about finalizers. A finalizer could send a "bye" packet throgh the
> net. That can't be handled by the OS.
It can't be handled by the GC either, because:
- This would require a high-level wra
Fawzi Mohamed, el 18 de abril a las 23:43 me escribiste:
> >If thread_joinAll() is called before gc_term(), I can't see how a thread
> >could be still running when gc_term() is called. So, in terms of threads,
> >I don't see a problem here.
>
> daemon theads are not joined
So, you can keep thread
dsimcha wrote:
How do you do something like the following with ranges?
auto foo = someRange([1U, 2, 3, 4, 5]);
foreach(index, elem; foo) {
writeln(index, " ", elem);
}
Has this been addressed yet?
No :o(.
Andrei
Walter Bright, el 18 de abril a las 14:34 me escribiste:
> Leandro Lucarella wrote:
> >Close a connection gracefully for example, I guess (I mean, send a "bye"
> >packed, not just close the socket abruptly). Same for closing files
> >writing some mark or something. They can be risky when finalizati
Walter Bright, el 18 de abril a las 14:33 me escribiste:
> Leandro Lucarella wrote:
> >The current GC implementation don't call finalizers for data that's still
> >reference when the program *ended* (this is allowed by the specs, so it's
> >fine, the question is why it's allowed by the specs).
>
>
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
How do you do something like the following with ranges?
auto foo = someRange([1U, 2, 3, 4, 5]);
foreach(index, elem; foo) {
writeln(index, " ", elem);
}
Has this been addressed yet?
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
Robert Jacques wrote:
On Sat, 18 Apr 2009 16:25:32 -0400, Don wrote:
Leandro Lucarella wrote:
Robert Jacques, el 18 de abril a las 11:56 me escribiste:
On Sat, 18 Apr 2009 11:24:14 -0400, Leandro Lucarella
wrote:
I've just found out[1] this[2]:
The garbage collector is not guaranteed
On 2009-04-18 23:22:21 +0200, Leandro Lucarella said:
Leandro Lucarella, el 18 de abril a las 18:03 me escribiste:
Fawzi Mohamed, el 18 de abril a las 22:48 me escribiste:
On 2009-04-18 22:25:32 +0200, Don said:
Leandro Lucarella wrote:
Robert Jacques, el 18 de abril a las 11:56 me escrib
On 2009-04-18 23:03:11 +0200, Leandro Lucarella said:
Fawzi Mohamed, el 18 de abril a las 22:48 me escribiste:
On 2009-04-18 22:25:32 +0200, Don said:
Leandro Lucarella wrote:
Robert Jacques, el 18 de abril a las 11:56 me escribiste:
On Sat, 18 Apr 2009 11:24:14 -0400, Leandro Lucarella
Leandro Lucarella wrote:
Close a connection gracefully for example, I guess (I mean, send a "bye"
packed, not just close the socket abruptly). Same for closing files
writing some mark or something. They can be risky when finalization is not
deterministic though.
Scoped objects should be used fo
Leandro Lucarella wrote:
The current GC implementation don't call finalizers for data that's still
reference when the program *ended* (this is allowed by the specs, so it's
fine, the question is why it's allowed by the specs).
The why is because of speed. What's the point of running a gc pause
Leandro Lucarella, el 18 de abril a las 18:03 me escribiste:
> Fawzi Mohamed, el 18 de abril a las 22:48 me escribiste:
> > On 2009-04-18 22:25:32 +0200, Don said:
> >
> > >Leandro Lucarella wrote:
> > >>Robert Jacques, el 18 de abril a las 11:56 me escribiste:
> > >>>On Sat, 18 Apr 2009 11:24:14
On Sat, 18 Apr 2009 16:25:32 -0400, Don wrote:
Leandro Lucarella wrote:
Robert Jacques, el 18 de abril a las 11:56 me escribiste:
On Sat, 18 Apr 2009 11:24:14 -0400, Leandro Lucarella
wrote:
I've just found out[1] this[2]:
The garbage collector is not guaranteed to run the destruc
Fawzi Mohamed, el 18 de abril a las 22:48 me escribiste:
> On 2009-04-18 22:25:32 +0200, Don said:
>
> >Leandro Lucarella wrote:
> >>Robert Jacques, el 18 de abril a las 11:56 me escribiste:
> >>>On Sat, 18 Apr 2009 11:24:14 -0400, Leandro Lucarella
> >>>wrote:
> I've just found out[1] this
On 2009-04-18 22:25:32 +0200, Don said:
Leandro Lucarella wrote:
Robert Jacques, el 18 de abril a las 11:56 me escribiste:
On Sat, 18 Apr 2009 11:24:14 -0400, Leandro Lucarella wrote:
I've just found out[1] this[2]:
The garbage collector is not guaranteed to run the destructor for
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
Don, el 18 de abril a las 22:25 me escribiste:
> >The current GC implementation don't call finalizers for data that's still
> >reference when the program *ended* (this is allowed by the specs, so it's
> >fine, the question is why it's allowed by the specs).
>
> I don't understand why D even has fi
Leandro Lucarella wrote:
Robert Jacques, el 18 de abril a las 11:56 me escribiste:
On Sat, 18 Apr 2009 11:24:14 -0400, Leandro Lucarella wrote:
I've just found out[1] this[2]:
The garbage collector is not guaranteed to run the destructor for
all unreferenced objects.
Is there
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
This is the final version I am added to the dlibs:
/
To create a memory pool of a native item, like structs. Not thread-safe.
It allows to create new items (it performs block-allocations for speed), and
then
free them all at once (and then you can creat
import std.stdio: writefln;
import std.string: format;
class Matrix(T) {
private T[][] m;
this() {}
this(int r, int c) {
this.m = new T[][](r, c);
}
this(int r, int c, T x) {
this.m = new T[][](r, c);
foreach (ref row; this.m)
row[] = x;
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'
So, I'm trying to create a matrix class that is templated, but I don't really
understand templates, so I don't know why this doesn't work. Any idea why I
can't seem to do 2-D arrays?
-Andrew
module matrix;
private import std.string;
class Matrix(T) {
private:
T[][] ma;
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
Robert Jacques, el 18 de abril a las 11:56 me escribiste:
> On Sat, 18 Apr 2009 11:24:14 -0400, Leandro Lucarella
> wrote:
> >I've just found out[1] this[2]:
> >
> > The garbage collector is not guaranteed to run the destructor for
> > all unreferenced objects.
> >
> >Is there any reason
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.
On Sat, 18 Apr 2009 11:24:14 -0400, Leandro Lucarella
wrote:
I've just found out[1] this[2]:
The garbage collector is not guaranteed to run the destructor for
all unreferenced objects.
Is there any reason why D can't guarantee that all finalizers will be
called, at least when
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
I've just found out[1] this[2]:
The garbage collector is not guaranteed to run the destructor for
all unreferenced objects.
Is there any reason why D can't guarantee that all finalizers will be
called, at least when the program ends?
[1] http://proj.llucax.com.ar/blog/dgc/blog/po
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
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 syntactically w
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); // call method bar
What op
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 OpA
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; Ra
1 - 100 of 115 matches
Mail list logo