Re: inheriting constructos

2009-11-30 Thread Don
Andrei Alexandrescu wrote: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit constructors. Example: class MyException : Exception {} b) If a class defines at least one constr

Re: inheriting constructos

2009-11-30 Thread davidl
在 Mon, 30 Nov 2009 09:35:17 +0800,Denis Koroskin <2kor...@gmail.com> 写道: On Mon, 30 Nov 2009 03:18:27 +0300, Andrei Alexandrescu wrote: Denis Koroskin wrote: On Mon, 30 Nov 2009 02:20:40 +0300, bearophile wrote: Andrei Alexandrescu: c) If a class doesn't define any constructors but

Re: inheriting constructos

2009-11-30 Thread Ary Borenszweig
Andrei Alexandrescu wrote: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit constructors. Example: class MyException : Exception {} b) If a class defines at least one constr

Microsoft's top developers prefer old-school coding methods

2009-11-30 Thread Justin Johansson
FYI D people. Snippet: Other programming gurus, such as Herb Sutter, lead designer of Microsoft's C++/CLI programming language, predict that writing code to run on bare metal may come back into fashion, as chip makers find themselves unable to keep boosting processor speeds at current rates.

Re: Phobos packages a bit confusing

2009-11-30 Thread KennyTM~
On Nov 30, 09 14:02, retard wrote: Mon, 30 Nov 2009 04:51:19 +, dsimcha wrote: == Quote from Nick Sabalausky (a...@a.a)'s article "retard" wrote in message news:heuh3h$o7...@digitalmars.com... Hi after using D1 and Tango for couple of years we decided to experiment with D2 and Phobos in

Re: dynamic classes and duck typing

2009-11-30 Thread Simen kjaeraas
On Mon, 30 Nov 2009 07:10:41 +0100, Walter Bright wrote: Walter Bright wrote: 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 Fixed reported problems with it: http://www.dsource.org/pr

Asserts and side effects

2009-11-30 Thread Lars T. Kyllingstad
The following is a quote from a comment in the Reddit post about asserts that Walter just linked to: "Asserts are not without pitfalls, though. If you aren't careful, what to put in the asserts, the program could behave differently" A trivial example of this is: int i; write(i

Re: Phobos packages a bit confusing

2009-11-30 Thread Ary Borenszweig
KennyTM~ wrote: By far the two most important pieces of I/O functionality I need are: 1. Read a text file line-by-line. foreach (line; new Lines!(char) (new File ("foobar.txt"))) Cout (line).newline; } yuck. Yuck?? I find that code very elegant. How would you like it to be?

Re: Microsoft's top developers prefer old-school coding methods

2009-11-30 Thread bearophile
Justin Johansson: > "I think we have maybe five to 10 years left [with Moore's Law]," he > said. "Optimizations will get very, very sexy again, when people realize > how we pay for abstractions." We'll see, but I don't believe that. We'll see. CPUs with 30 cores require a different kind of opti

Re: Asserts and side effects

2009-11-30 Thread bearophile
Lars T. Kyllingstad: > Would it be possible (and desirable) for the D compiler to statically > check that asserts have no side effects? Only pure asserts? If you put: assert (++i == 1); Inside a function precondition, it gets removed in release mode. Bye, bearophile

Re: Phobos packages a bit confusing

2009-11-30 Thread Lars T. Kyllingstad
Ary Borenszweig wrote: KennyTM~ wrote: By far the two most important pieces of I/O functionality I need are: 1. Read a text file line-by-line. foreach (line; new Lines!(char) (new File ("foobar.txt"))) Cout (line).newline; } yuck. Yuck?? I find that code very elegant. How would you l

Re: Asserts and side effects

2009-11-30 Thread Denis Koroskin
On Mon, 30 Nov 2009 13:52:48 +0300, Lars T. Kyllingstad wrote: The following is a quote from a comment in the Reddit post about asserts that Walter just linked to: "Asserts are not without pitfalls, though. If you aren't careful, what to put in the asserts, the program could beh

Re: Phobos packages a bit confusing

2009-11-30 Thread retard
Mon, 30 Nov 2009 12:01:22 +0100, Ary Borenszweig wrote: > KennyTM~ wrote: By far the two most important pieces of I/O functionality I need are: 1. Read a text file line-by-line. >>> >>> foreach (line; new Lines!(char) (new File ("foobar.txt"))) >>>Cout (line).newline; >>>

Re: Asserts and side effects

2009-11-30 Thread KennyTM~
On Nov 30, 09 19:15, Denis Koroskin wrote: On Mon, 30 Nov 2009 13:52:48 +0300, Lars T. Kyllingstad wrote: The following is a quote from a comment in the Reddit post about asserts that Walter just linked to: "Asserts are not without pitfalls, though. If you aren't careful, what to put in the a

Re: Phobos packages a bit confusing

2009-11-30 Thread KennyTM~
On Nov 30, 09 19:01, Ary Borenszweig wrote: KennyTM~ wrote: By far the two most important pieces of I/O functionality I need are: 1. Read a text file line-by-line. foreach (line; new Lines!(char) (new File ("foobar.txt"))) Cout (line).newline; } yuck. Yuck?? I find that code very elegant

Re: Asserts and side effects

2009-11-30 Thread Denis Koroskin
On Mon, 30 Nov 2009 15:46:45 +0300, KennyTM~ wrote: On Nov 30, 09 19:15, Denis Koroskin wrote: On Mon, 30 Nov 2009 13:52:48 +0300, Lars T. Kyllingstad wrote: The following is a quote from a comment in the Reddit post about asserts that Walter just linked to: "Asserts are not without pitfal

Re: Asserts and side effects

2009-11-30 Thread Don
Denis Koroskin wrote: On Mon, 30 Nov 2009 15:46:45 +0300, KennyTM~ wrote: On Nov 30, 09 19:15, Denis Koroskin wrote: On Mon, 30 Nov 2009 13:52:48 +0300, Lars T. Kyllingstad wrote: The following is a quote from a comment in the Reddit post about asserts that Walter just linked to: "Asserts

Re: dynamic classes and duck typing

2009-11-30 Thread bearophile
Simen kjaeraas: > test.d(10): Error: template instance opDispatch!("bar") does not match > template declaration opDispatch(string name,T) For Walter: this quick coding-testing cycle is an huge improvement over the original way DMD was developed. Things can be improved still of course, but this

Re: Phobos packages a bit confusing

2009-11-30 Thread retard
Mon, 30 Nov 2009 21:06:21 +0800, KennyTM~ wrote: > On Nov 30, 09 19:01, Ary Borenszweig wrote: >> KennyTM~ wrote: > By > far the two most important pieces of I/O functionality I need are: > > 1. Read a text file line-by-line. foreach (line; new Lines!(char) (new File ("fo

Re: Phobos packages a bit confusing

2009-11-30 Thread Nick Sabalausky
"retard" wrote in message news:hevn56$2to...@digitalmars.com... > Mon, 30 Nov 2009 04:51:19 +, dsimcha wrote: >> >> Yeah, I dislike Tango's (and Java's) I/O design. I think it's a classic >> example of overengineering. I don't care how efficient, flexible, >> complete, etc. it is if it does

Re: Phobos packages a bit confusing

2009-11-30 Thread Nick Sabalausky
"retard" wrote in message news:hevo45$2to...@digitalmars.com... > Mon, 30 Nov 2009 04:55:29 +, dsimcha wrote: > > Well, they have been teaching the Java i/o stuff to first year students > for a while now. I completely agree that it's a bit too complicated for > novices, but it's not the only

Re: inheriting constructos

2009-11-30 Thread Nick Sabalausky
"Ary Borenszweig" wrote in message news:hf03ps$lk...@digitalmars.com... > Andrei Alexandrescu wrote: >> Walter and I just discussed the matter of inheriting constructors. Our >> thought on the issue: >> >> a) If a class doesn't define any constructors and adds no fields, inherit >> constructors

Re: Vectorized Laziness

2009-11-30 Thread bearophile
It seems I was not fully mad, Clojure designers have had the same idea, see page 29 of this document (Click on it, don't save as): http://clojure.googlegroups.com/web/ClojureExperience.pdf Be well, bearophile

Re: Microsoft's top developers prefer old-school coding methods

2009-11-30 Thread Nick Sabalausky
"bearophile" wrote in message news:hf0976$v2...@digitalmars.com... > Justin Johansson: >> "I think we have maybe five to 10 years left [with Moore's Law]," he >> said. "Optimizations will get very, very sexy again, when people realize >> how we pay for abstractions." > > We'll see, but I don't be

Re: Pure, Nothrow in Generic Programming

2009-11-30 Thread Andrei Alexandrescu
Rainer Deyke wrote: Andrei Alexandrescu wrote: Denis Koroskin wrote: Points 2 and 3 introduce undefined behavior, which is not allowed in SafeD :p s/undefined/implementation-defined/ Behavior is only implementation-defined if the implementation actually defines it. When targeting a specific

Re: Phobos packages a bit confusing

2009-11-30 Thread Andrei Alexandrescu
retard wrote: Mon, 30 Nov 2009 21:06:21 +0800, KennyTM~ wrote: On Nov 30, 09 19:01, Ary Borenszweig wrote: KennyTM~ wrote: By far the two most important pieces of I/O functionality I need are: 1. Read a text file line-by-line. foreach (line; new Lines!(char) (new File ("foobar.txt"))) Cout

Re: Phobos packages a bit confusing

2009-11-30 Thread Andrei Alexandrescu
retard wrote: Mon, 30 Nov 2009 12:01:22 +0100, Ary Borenszweig wrote: KennyTM~ wrote: By far the two most important pieces of I/O functionality I need are: 1. Read a text file line-by-line. foreach (line; new Lines!(char) (new File ("foobar.txt"))) Cout (line).newline; } yuck. Yuck??

Re: inheriting constructos

2009-11-30 Thread Andrei Alexandrescu
Don wrote: Andrei Alexandrescu wrote: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit constructors. Example: class MyException : Exception {} b) If a class defines at leas

Re: Phobos packages a bit confusing

2009-11-30 Thread Denis Koroskin
On Mon, 30 Nov 2009 18:25:41 +0300, Andrei Alexandrescu wrote: retard wrote: Mon, 30 Nov 2009 12:01:22 +0100, Ary Borenszweig wrote: KennyTM~ wrote: By far the two most important pieces of I/O functionality I need are: 1. Read a text file line-by-line. foreach (line; new Lines!(char) (

Re: inheriting constructos

2009-11-30 Thread Don
Andrei Alexandrescu wrote: Don wrote: Andrei Alexandrescu wrote: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit constructors. Example: class MyException : Exception {} b

Re: Phobos packages a bit confusing

2009-11-30 Thread dsimcha
== Quote from retard (r...@tard.com.invalid)'s article > Mon, 30 Nov 2009 21:06:21 +0800, KennyTM~ wrote: > > On Nov 30, 09 19:01, Ary Borenszweig wrote: > >> KennyTM~ wrote: > > By > > far the two most important pieces of I/O functionality I need are: > > > > 1. Read a text file li

Re: inheriting constructos

2009-11-30 Thread Michel Fortin
On 2009-11-29 18:03:40 -0500, Andrei Alexandrescu said: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit constructors. Example: class MyException : Exception {} b) If a c

Re: Phobos packages a bit confusing

2009-11-30 Thread dsimcha
== Quote from dsimcha (dsim...@yahoo.com)'s article > == Quote from retard (r...@tard.com.invalid)'s article > > Mon, 30 Nov 2009 21:06:21 +0800, KennyTM~ wrote: > > > On Nov 30, 09 19:01, Ary Borenszweig wrote: > > >> KennyTM~ wrote: > > > By > > > far the two most important pieces of I/O

Re: inheriting constructos

2009-11-30 Thread Michel Fortin
On 2009-11-30 10:30:11 -0500, Andrei Alexandrescu said: class MyException : Exception { private int sysCode; invariant() { assert(sysCode < 100); } } If default initialization of the field puts it in a state that respects the invariant, there isn't a problem. I think this simply

Re: new version

2009-11-30 Thread BCS
Hello l8night, 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. Check me on this but there may be more know bugs in things like FireFox then in DMD. The length of the bug list in and of its self say almost

Re: new version

2009-11-30 Thread dsimcha
== Quote from BCS (n...@anon.com)'s article > Hello l8night, > > 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. > > > Check me on this but there may be more know bugs in things like FireFox then > in DMD. Th

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Simen kjaeraas wrote: This still does not compile: struct foo { void opDispatch( string name, T )( T value ) { } } void main( ) { foo f; f.bar( 3.14 ); } test.d(10): Error: template instance opDispatch!("bar") does not match template declaration opDispatch(string name,T) It

Re: inheriting constructos

2009-11-30 Thread Sean Kelly
Andrei Alexandrescu Wrote: > Walter and I just discussed the matter of inheriting constructors. Our > thought on the issue: > > a) If a class doesn't define any constructors and adds no fields, > inherit constructors. Example: > > class MyException : Exception {} > > b) If a class defines at

Re: inheriting constructos

2009-11-30 Thread Sean Kelly
Michel Fortin Wrote: > On 2009-11-29 18:03:40 -0500, Andrei Alexandrescu > said: > > > Walter and I just discussed the matter of inheriting constructors. Our > > thought on the issue: > > > > a) If a class doesn't define any constructors and adds no fields, > > inherit constructors. Example:

Re: new version

2009-11-30 Thread l8night
hi, thank you all for your answers. i think your are right with “look for the severity of bugs”. for my superiors however the thing is different. they just see a huge amount of bugs, missing gui libraries, missing database libraries and nothing close to anything that m$ offers in the way of deve

Re: Phobos packages a bit confusing

2009-11-30 Thread Andrei Alexandrescu
Denis Koroskin wrote: On Mon, 30 Nov 2009 18:25:41 +0300, Andrei Alexandrescu wrote: retard wrote: Mon, 30 Nov 2009 12:01:22 +0100, Ary Borenszweig wrote: KennyTM~ wrote: By far the two most important pieces of I/O functionality I need are: 1. Read a text file line-by-line. foreach (li

Re: Reference counting for resource management

2009-11-30 Thread Bartosz Milewski
Denis Koroskin Wrote: > I think RefCounted should be flexible enough to re-usable for other data > structures, too (e.g. so that it could be part of Phobos). > I agree. However this code goes into core, so it can't use Phobos. > By the way, your code has a bug: > > Tid tid; // or release() a

Re: dynamic classes and duck typing

2009-11-30 Thread Álvaro Castro-Castilla
Walter Bright Wrote: > Simen kjaeraas wrote: > > This still does not compile: > > > > struct foo { > > void opDispatch( string name, T )( T value ) { > > } > > } > > > > void main( ) { > > foo f; > > f.bar( 3.14 ); > > } > > > > test.d(10): Error: template instance opDispatch!("

Re: Phobos packages a bit confusing

2009-11-30 Thread Roman Ivanov
retard Wrote: > Java isn't that bad IMO - you just have to remember the buffer: > > BufferedReader input = new BufferedReader(new FileReader("foo")); > try { > String line = null; > > while (( line = input.readLine()) != null) { > } > } > finally { > input.close(); > } One of the importa

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Álvaro Castro-Castilla wrote: It does. Shouldn't this work also? struct foo { void opDispatch( string name, T... )( T values ) { } } void main( ) {

Converting Optlink from Assembler to C

2009-11-30 Thread Walter Bright
http://www.reddit.com/r/programming/comments/a9lxo/assembler_to_c/

Re: Phobos packages a bit confusing

2009-11-30 Thread dsimcha
== Quote from Roman Ivanov (isro...@km.ru)'s article > retard Wrote: > > Java isn't that bad IMO - you just have to remember the buffer: > > > > BufferedReader input = new BufferedReader(new FileReader("foo")); > > try { > > String line = null; > > > > while (( line = input.readLine()) != null)

Re: Custom search engine for D resources on the web

2009-11-30 Thread Jesse Phillips
George Moss Wrote: > Over in the other camp, someone has set up a custom search engine > "for everyone complaining that it is impossible to search for Go docs > and info". > > http://go-lang.cat-v.org/go-search > > Given similar complains about the likewise "search-unfriendly D word", > perhaps

Re: Converting Optlink from Assembler to C

2009-11-30 Thread Vladimir Panteleev
On Mon, 30 Nov 2009 23:02:13 +0200, Walter Bright wrote: http://www.reddit.com/r/programming/comments/a9lxo/assembler_to_c/ The link posted on reddit in broken: "You are not authorised to view this resource. You need to login." Broken link: http://dobbscodetalk.com/index.php?option=c

Re: Phobos packages a bit confusing

2009-11-30 Thread Leandro Lucarella
Lars T. Kyllingstad, el 30 de noviembre a las 12:16 me escribiste: > Ary Borenszweig wrote: > >KennyTM~ wrote: > By > far the two most important pieces of I/O functionality I need are: > > 1. Read a text file line-by-line. > >>> > >>>foreach (line; new Lines!(char) (new File ("foo

Re: dynamic classes and duck typing

2009-11-30 Thread Bill Baxter
On Mon, Nov 30, 2009 at 1:00 PM, Walter Bright wrote: > Álvaro Castro-Castilla wrote: >> >> It does. Shouldn't this work also? >> >> struct foo { >>    void opDispatch( string name, T... )( T values ) {    }   } >> >>                                                             void main( ) { >>  f

Re: dynamic classes and duck typing

2009-11-30 Thread Roman Ivanov
Walter Bright Wrote: > dsimcha wrote: > > Right, but sometimes (though certainly not always) it's better to provide a > > meta-feature that solves a whole bunch of problems (like better templates) > > and > > then solve the individual problems at the library level, rather than add a > > language

Re: dynamic classes and duck typing

2009-11-30 Thread Simen kjaeraas
On Mon, 30 Nov 2009 19:07:38 +0100, Walter Bright wrote: Simen kjaeraas wrote: This still does not compile: struct foo { void opDispatch( string name, T )( T value ) { } } void main( ) { foo f; f.bar( 3.14 ); } test.d(10): Error: template instance opDispatch!("bar") does n

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Bill Baxter wrote: On Mon, Nov 30, 2009 at 1:00 PM, Walter Bright void opDispatch(string name, T...)(T values...) ^^^ You didn't use to have to do that with variadic templates. Is that also a new change in SVN? I believe it was always like th

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Roman Ivanov wrote: My point is, language is one thing, but "language culture" is another. For some reason Java bred a culture that encourages bloated, counter-intuitive, "enterprise" solutions. It's not inherent in the language. It has more to do with the companies that use it, core API design a

Re: Phobos packages a bit confusing

2009-11-30 Thread Pelle Månsson
Ary Borenszweig wrote: KennyTM~ wrote: By far the two most important pieces of I/O functionality I need are: 1. Read a text file line-by-line. foreach (line; new Lines!(char) (new File ("foobar.txt"))) Cout (line).newline; } yuck. Yuck?? I find that code very elegant. How would you l

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Simen kjaeraas wrote: I'm already in love with this feature. So am I. It seems to be incredibly powerful. Looks to me you can do things like: 1. hook up to COM's IDispatch 2. create 'classes' at runtime 3. add methods to existing classes (monkey patching) that allow such extensions 4. pr

Re: dynamic classes and duck typing

2009-11-30 Thread dsimcha
== Quote from Roman Ivanov (x...@y.z)'s article > Walter Bright Wrote: > > dsimcha wrote: > > > Right, but sometimes (though certainly not always) it's better to provide > > > a > > > meta-feature that solves a whole bunch of problems (like better > > > templates) and > > > then solve the individ

Re: dynamic classes and duck typing

2009-11-30 Thread Pelle Månsson
Walter Bright wrote: Bill Baxter wrote: On Mon, Nov 30, 2009 at 1:00 PM, Walter Bright void opDispatch(string name, T...)(T values...) ^^^ You didn't use to have to do that with variadic templates. Is that also a new change in SVN? I believe

Re: dynamic classes and duck typing

2009-11-30 Thread Simen kjaeraas
On Mon, 30 Nov 2009 23:02:46 +0100, Walter Bright wrote: Simen kjaeraas wrote: I'm already in love with this feature. So am I. It seems to be incredibly powerful. Looks to me you can do things like: 1. hook up to COM's IDispatch 2. create 'classes' at runtime 3. add methods to existing

Re: dynamic classes and duck typing

2009-11-30 Thread Simen kjaeraas
On Mon, 30 Nov 2009 23:13:23 +0100, Pelle Månsson wrote: Walter Bright wrote: Bill Baxter wrote: On Mon, Nov 30, 2009 at 1:00 PM, Walter Bright void opDispatch(string name, T...)(T values...) ^^^ You didn't use to have to do that with vari

Re: Converting Optlink from Assembler to C

2009-11-30 Thread Spacen Jasset
Vladimir Panteleev wrote: On Mon, 30 Nov 2009 23:02:13 +0200, Walter Bright wrote: http://www.reddit.com/r/programming/comments/a9lxo/assembler_to_c/ The link posted on reddit in broken: "You are not authorised to view this resource. You need to login." Broken link: http://dobbscodetal

Re: dynamic classes and duck typing

2009-11-30 Thread Pelle Månsson
Simen kjaeraas wrote: On Mon, 30 Nov 2009 23:13:23 +0100, Pelle Månsson wrote: Walter Bright wrote: Bill Baxter wrote: On Mon, Nov 30, 2009 at 1:00 PM, Walter Bright void opDispatch(string name, T...)(T values...) ^^^ You didn't use to hav

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Simen kjaeraas wrote: Oh, and another thing: Will we get property syntax for this? I'd like to use this for shaders, allowing one to refer to the shader's own variables directly from D, but currently I am limited to function call syntax (unless I'm missing something?) You can do it, but be car

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
dsimcha wrote: In Java, by going overboard on making the core language simple, you end up pushing all the complexity into the APIs. Yup, and that's the underlying problem with "simple" languages. Complicated code.

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Simen kjaeraas wrote: It would seem Walter is right, but only for opDispatch. This compiles fine. If you want compile errors, move the ellipsis around: Hmm, looks like there is a problem, but it has nothing to do with opDispatch, as this: void bar(string s, T...)(T args) doesn't work ei

Re: dynamic classes and duck typing

2009-11-30 Thread Denis Koroskin
On Tue, 01 Dec 2009 00:00:23 +0300, Walter Bright wrote: Álvaro Castro-Castilla wrote: It does. Shouldn't this work also? struct foo { void opDispatch( string name, T... )( T values ) { } }

Re: Phobos packages a bit confusing

2009-11-30 Thread bearophile
Pelle MÃ¥nsson: > foreach (line; open("foobar.txt")) { >writeln(line); > } With the xio module of my dlibs: import d.xio: xfile; foreach (line; xfile("foobar.txt")) putr(line); xfile is optimized to reduce memory rellocations as much as possible in the most common case of about 90 char

Re: Phobos packages a bit confusing

2009-11-30 Thread Andrei Alexandrescu
bearophile wrote: Pelle MÃ¥nsson: foreach (line; open("foobar.txt")) { writeln(line); } With the xio module of my dlibs: import d.xio: xfile; foreach (line; xfile("foobar.txt")) putr(line); xfile is optimized to reduce memory rellocations as much as possible in the most common case

Re: dynamic classes and duck typing

2009-11-30 Thread Alvaro Castro-Castilla
Walter Bright Wrote: > Simen kjaeraas wrote: > > I'm already in love with this feature. > > So am I. It seems to be incredibly powerful. > > Looks to me you can do things like: > > 1. hook up to COM's IDispatch > > 2. create 'classes' at runtime > > 3. add methods to existing classes (monkey

Re: dynamic classes and duck typing

2009-11-30 Thread bearophile
Walter Bright: > So am I. It seems to be incredibly powerful. Very powerful things can be dangerous too, they can lead to bugs, etc. > Looks to me you can do things like: This is stuff that can be written in the D docs to, for example you can add some of those examples in the D2 docs page abou

Re: inheriting constructos

2009-11-30 Thread Ary Borenszweig
Nick Sabalausky wrote: "Ary Borenszweig" wrote in message news:hf03ps$lk...@digitalmars.com... Andrei Alexandrescu wrote: Walter and I just discussed the matter of inheriting constructors. Our thought on the issue: a) If a class doesn't define any constructors and adds no fields, inherit co

useSameLockAs

2009-11-30 Thread Andrei Alexandrescu
I'm thinking of adding a final method to Object: final void useSameLockAs(Object another); What it does is to make "this" give up on its own lock object and use the same lock as "another". Probably this may restrict implementations to some degree (e.g. I'm not sure how that would work with thi

Re: dynamic classes and duck typing

2009-11-30 Thread Bill Baxter
On Mon, Nov 30, 2009 at 3:38 PM, bearophile wrote: > Walter Bright: >> So am I. It seems to be incredibly powerful. > > Very powerful things can be dangerous too, they can lead to bugs, etc. I'm a bit concerned about what this does to introspection. With a dynamic language like Python, adding run

Converting Optlink from Assembler to C - Reboot

2009-11-30 Thread Walter Bright
http://www.reddit.com/r/programming/comments/a9mse/walter_bright_from_assembly_to_c/ Hopefully a working link this time.

Re: dynamic classes and duck typing

2009-11-30 Thread Bill Baxter
On Mon, Nov 30, 2009 at 3:20 PM, Alvaro Castro-Castilla wrote: > Walter Bright Wrote: > >> Simen kjaeraas wrote: >> > I'm already in love with this feature. >> >> So am I. It seems to be incredibly powerful. >> >> Looks to me you can do things like: >> >> ... >> >> 5. the already mentioned "swizzl

Re: dynamic classes and duck typing

2009-11-30 Thread Alvaro Castro-Castilla
Walter Bright Wrote: > Simen kjaeraas wrote: > > It would seem Walter is right, but only for opDispatch. This compiles > > fine. If you want compile errors, move the ellipsis around: > > Hmm, looks like there is a problem, but it has nothing to do with > opDispatch, as this: > > void bar(s

Re: Converting Optlink from Assembler to C

2009-11-30 Thread Adam D. Ruppe
On Mon, Nov 30, 2009 at 10:14:32PM +, Spacen Jasset wrote: > The article doesn't really say why optlink? That's not really the point though - the article is discussing "how" rather than "why". > Why not use another linker? Speed is a big one, but I imagine familiarity is another - Walter ha

Re: dynamic classes and duck typing

2009-11-30 Thread Adam D. Ruppe
On Mon, Nov 30, 2009 at 02:02:46PM -0800, Walter Bright wrote: > 3. add methods to existing classes (monkey patching) that allow such > extensions I think allowing this in general is a bad idea - the opDispatch should only be implemented on a small number of classes. The reason is simple: a typo

Re: Converting Optlink from Assembler to C - Reboot

2009-11-30 Thread bearophile
A nice article, thank you for writing it for us for free (I used to pay to read similar texts). >I had the job at the time of converting a huge (and very successful) >electronic schematic editor, DASH, from assembler into C. In C it could then >be recompiled for 32 bits, and even ported to othe

Unofficial wish list status.(Dec 2009)

2009-11-30 Thread 4tuu4k002
Hi This is the monthly status for the unofficial d wish list: http://all-technology.com/eigenpolls/dwishlist/ I am closing this wish list. New requests should be posted to bugzilla on http://d.puremagic.com/issues/ It would be a great help, if you could help move some of the wish list items

Re: new version

2009-11-30 Thread Don
l8night wrote: hi, thank you all for your answers. i think your are right with “look for the severity of bugs”. for my superiors however the thing is different. they just see a huge amount of bugs, missing gui libraries, missing database libraries and nothing close to anything that m$ offers i

Re: Phobos packages a bit confusing

2009-11-30 Thread bearophile
Andrei Alexandrescu: > Why not just reuse the same buffer as the previous line? That approach > is inherently adaptive. That approach is unsafe. xfile yields byte strings, in D1. When I write 10 lines long scripts I usually don't need every bit of optimization, I need the less bug-prone code as

Re: dynamic classes and duck typing

2009-11-30 Thread Leandro Lucarella
Bill Baxter, el 30 de noviembre a las 16:09 me escribiste: > On Mon, Nov 30, 2009 at 3:38 PM, bearophile wrote: > > Walter Bright: > >> So am I. It seems to be incredibly powerful. > > > > Very powerful things can be dangerous too, they can lead to bugs, etc. > > I'm a bit concerned about what th

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Alvaro Castro-Castilla wrote: I think this doesn't work as should. This code: Yes, you're right. I'll look into fixing it.

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Bill Baxter wrote: And once again we see Clugston's Law at work. As soon as you figure out how to do one thing in D, a new compiler feature comes along that makes it a one-liner. :-) The goal is to write a D compiler in one line of code!

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Bill Baxter wrote: Also how does this interact with property syntax? Define opDispatch with @property.

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Adam D. Ruppe wrote: On Mon, Nov 30, 2009 at 02:02:46PM -0800, Walter Bright wrote: 3. add methods to existing classes (monkey patching) that allow such extensions I think allowing this in general is a bad idea - the opDispatch should only be implemented on a small number of classes. The reas

Re: Custom search engine for D resources on the web

2009-11-30 Thread Walter Bright
Jesse Phillips wrote: I think if there was more thorough documentation, using ignorant terminology during explanation, you would see a much better return on your search results. The documentation is written with google in mind, hence what I expect to be the most common search terms for the pag

Re: dynamic classes and duck typing

2009-11-30 Thread Bill Baxter
On Mon, Nov 30, 2009 at 6:03 PM, Walter Bright wrote: > Bill Baxter wrote: >> >> Also how does this interact with property syntax? > > Define opDispatch with @property. So we can overload on @property-ness? I.e. this works struct S { @property float x() { return 1.0f; } float x() { return 2.0f;

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Bill Baxter wrote: So we can overload on @property-ness? No. I.e. this works struct S { @property float x() { return 1.0f; } float x() { return 2.0f; } } void main() { S s; writefln("%s", s.x); // writes 1.0 writefln("%s", s.x()); // writes 2.0 } That just looks wrong.

Quebec City

2009-11-30 Thread Andrei Alexandrescu
Hello, I'll be in Quebec City on 10-13 December. I understand a couple of you are from there. If you want to have a beer on Saturday night, please let me know! Andrei

Re: useSameLockAs

2009-11-30 Thread Sean Kelly
Andrei Alexandrescu Wrote: > I'm thinking of adding a final method to Object: > > final void useSameLockAs(Object another); > > What it does is to make "this" give up on its own lock object and use > the same lock as "another". Probably this may restrict implementations > to some degree (e.g.

Re: inheriting constructos

2009-11-30 Thread Sean Kelly
Ary Borenszweig Wrote: > Nick Sabalausky wrote: > > "Ary Borenszweig" wrote in message > > news:hf03ps$lk...@digitalmars.com... > >> Andrei Alexandrescu wrote: > >>> Walter and I just discussed the matter of inheriting constructors. Our > >>> thought on the issue: > >>> > >>> a) If a class does

Re: dynamic classes and duck typing

2009-11-30 Thread Bill Baxter
On Mon, Nov 30, 2009 at 7:12 PM, Walter Bright wrote: > Bill Baxter wrote: >> >> So we can overload on @property-ness? > > No. > >> I.e. this works >> >> struct S >> { >> @property >> float x() { return 1.0f; } >> float x() { return 2.0f; } >> } >> >> void main() >> { >>    S  s; >>    writefln("%

Re: dynamic classes and duck typing

2009-11-30 Thread Andrei Alexandrescu
Bill Baxter wrote: On Mon, Nov 30, 2009 at 7:12 PM, Walter Bright wrote: Bill Baxter wrote: So we can overload on @property-ness? No. I.e. this works struct S { @property float x() { return 1.0f; } float x() { return 2.0f; } } void main() { S s; writefln("%s", s.x); // writes 1.0

Re: dynamic classes and duck typing

2009-11-30 Thread Walter Bright
Andrei Alexandrescu wrote: Bill Baxter wrote: On Mon, Nov 30, 2009 at 7:12 PM, Walter Bright wrote: Bill Baxter wrote: So we can overload on @property-ness? No. I.e. this works struct S { @property float x() { return 1.0f; } float x() { return 2.0f; } } void main() { S s; writefln