Re: Many questions

2009-05-05 Thread Denis Koroskin
On Wed, 06 May 2009 02:36:21 +0400, Christopher Wright wrote: I see no use case for having one module in multiple files, though -- the only benefit would be private access to things defined in other files. I've never been big on making stuff private, though. There is a use-case. Imagine y

Re: Destructors and Deterministic Memory Management

2009-05-05 Thread Sean Kelly
Georg Wrede wrote: Sean Kelly wrote: dsimcha wrote: Two closely related topics here: 1. It is often nice to be able to create a single object that works with both GC and deterministic memory management. The idea is that, if delete is called manually, all sub-objects would be freed determin

Re: Precedence of 'new' vs '.'

2009-05-05 Thread Ary Borenszweig
Frank Benoit escribió: In Java one can write: new MyClass().run(); in D this does not compile, parenthesis are needed. (new MyClass()).run(); But why is the D language designed like that? I think it's because the (already hated by many, including myself) ability to invoke a function (or a

Memory safety, C#, D and more

2009-05-05 Thread bearophile
Here I have collected few more bits that may be interesting for D development/design. --- In C# the "fixed" statement prevents the garbage collector from relocating a movable variable. The fixed statement is only permitted in an unsafe context: http://msdn.microsoft.com/en-us/l

Re: Precedence of 'new' vs '.'

2009-05-05 Thread Jarrett Billingsley
On Tue, May 5, 2009 at 8:49 PM, Derek Parnell wrote: > So presumably if it was changed to behave as Java, to get the current > functionality one would need to write ... > > new (MyClass().run()); Except that currently has no meaning, since you can't return a type from a function :P

Re: Precedence of 'new' vs '.'

2009-05-05 Thread Derek Parnell
On Wed, 06 May 2009 00:39:12 +0200, Frank Benoit wrote: > In Java one can write: > > new MyClass().run(); > > in D this does not compile, parenthesis are needed. > > (new MyClass()).run(); > > But why is the D language designed like that? So presumably if it was changed to behave as Java, to

Re: Precedence of 'new' vs '.'

2009-05-05 Thread Frank Benoit
Robert Fraser schrieb: > me too... Bugzilla, anyone? http://d.puremagic.com/issues/show_bug.cgi?id=2945

Re: A Modest Proposal: Final class instances

2009-05-05 Thread Stewart Gordon
dsimcha wrote: 1. Method calls don't need to be virtual. 2. An instance of a subclass cannot be converted to a final instance of the base class. 3. A final instance can be implicitly converted to a non-final instance, but the opposite would not work. Using final as an instance attribute like

Re: Precedence of 'new' vs '.'

2009-05-05 Thread Robert Fraser
BCS wrote: Reply to Frank, In Java one can write: new MyClass().run(); in D this does not compile, parenthesis are needed. (new MyClass()).run(); But why is the D language designed like that? vote++ me too... Bugzilla, anyone?

Re: Precedence of 'new' vs '.'

2009-05-05 Thread Nick Sabalausky
"Frank Benoit" wrote in message news:gtqf6c$8m...@digitalmars.com... > In Java one can write: > > new MyClass().run(); > > in D this does not compile, parenthesis are needed. > > (new MyClass()).run(); > > But why is the D language designed like that? I'm torn on this. On one hand, I'm uncomfor

Re: Precedence of 'new' vs '.'

2009-05-05 Thread BCS
Reply to Frank, In Java one can write: new MyClass().run(); in D this does not compile, parenthesis are needed. (new MyClass()).run(); But why is the D language designed like that? vote++

Re: Many questions

2009-05-05 Thread Christopher Wright
grauzone wrote: Christopher Wright wrote: It *is* possible, by use of public imports. Are you splitting one file into many? Public import the other modules. Are you merging many files into one? Leave the other files with just a public import of the merged file. Nice story. In reality you fa

Precedence of 'new' vs '.'

2009-05-05 Thread Frank Benoit
In Java one can write: new MyClass().run(); in D this does not compile, parenthesis are needed. (new MyClass()).run(); But why is the D language designed like that?

Re: A Modest Proposal: Final class instances

2009-05-05 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Walter Bright wrote: > dsimcha wrote: >> == Quote from Walter Bright (newshou...@digitalmars.com)'s article >>> dsimcha wrote: A possible solution is, given a class: class Foo { // Actual implementation. } fi

Re: A Modest Proposal: Final class instances

2009-05-05 Thread Walter Bright
dsimcha wrote: == Quote from Walter Bright (newshou...@digitalmars.com)'s article dsimcha wrote: A possible solution is, given a class: class Foo { // Actual implementation. } final class FooFinal : Foo{ // Dummy that just makes Foo final. } With dmd: final class A { } class B

Re: A Modest Proposal: Final class instances

2009-05-05 Thread BCS
Reply to dsimcha, Several people have griped in the past that D class methods are virtual by default. I've pointed out to them that you can get around this by making the methods final. However, this is a bit of a blunt instrument, because some use cases for a single class may call for polymorp

Re: could someone check this on another system?

2009-05-05 Thread BCS
Reply to Kagamin, BCS Wrote: I've posted the code here: http://smplsite.com/filebox/error.zip auto r = (rp == Point(-.5,1.5)); writef("---%s\n", r); assert(r, "++"~rp.toString); Is this it? Yes that's the spot that was (is?) generating an error. I'm not so sure anymore as my system is

Re: Many questions

2009-05-05 Thread grauzone
Christopher Wright wrote: Georg Wrede wrote: Yigal Chripun wrote: *but*, I do think that splitting one file that got too big over time or uniting a bunch of small files into one should be possible. This would be especially good for us. D is mainly developed by individuals, and there projects

Re: A Modest Proposal: Final class instances

2009-05-05 Thread dsimcha
== Quote from Walter Bright (newshou...@digitalmars.com)'s article > dsimcha wrote: > > A possible > > solution is, given a class: > > > > class Foo { > > // Actual implementation. > > } > > > > final class FooFinal : Foo{ > > // Dummy that just makes Foo final. > > } > With dmd: >final

Re: A Modest Proposal: Final class instances

2009-05-05 Thread Walter Bright
dsimcha wrote: A possible solution is, given a class: class Foo { // Actual implementation. } final class FooFinal : Foo{ // Dummy that just makes Foo final. } With dmd: final class A { } class B : A { } Compiling: test.d(2): Error: class test.B cannot inherit from final clas

Re: I wish I could use D for everything

2009-05-05 Thread Daniel de Kok
On Fri, May 1, 2009 at 12:56 AM, Robert Fraser wrote: > bearophile wrote: >> >> But today most people use languages like Java, Python, C#, that often >> shorten developing time even more than D1. >> D1 is almost a system language, so it's not easy to compete with the >> productivity of application

Re: could someone check this on another system?

2009-05-05 Thread Kagamin
BCS Wrote: > I've posted the code here: > > http://smplsite.com/filebox/error.zip > auto r = (rp == Point(-.5,1.5)); writef("---%s\n", r); assert(r, "++"~rp.toString); Is this it?

Re: A Modest Proposal: Final class instances

2009-05-05 Thread Jason House
IMHO, this proposal does not go far enough. THose that worry about performance also care about object size. If a vtable or monitor are needed, then people will still avoid classes for performance. dsimcha Wrote: > Several people have griped in the past that D class methods are virtual by > defa

Re: Destructors and Deterministic Memory Management

2009-05-05 Thread Georg Wrede
Georg Wrede wrote: Sean Kelly wrote: dsimcha wrote: Two closely related topics here: 1. It is often nice to be able to create a single object that works with both GC and deterministic memory management. The idea is that, if delete is called manually, all sub-objects would be freed determin

Re: Destructors and Deterministic Memory Management

2009-05-05 Thread Georg Wrede
Sean Kelly wrote: dsimcha wrote: Two closely related topics here: 1. It is often nice to be able to create a single object that works with both GC and deterministic memory management. The idea is that, if delete is called manually, all sub-objects would be freed deterministically, but the

Re: Many questions

2009-05-05 Thread Christopher Wright
Georg Wrede wrote: Yigal Chripun wrote: *but*, I do think that splitting one file that got too big over time or uniting a bunch of small files into one should be possible. This would be especially good for us. D is mainly developed by individuals, and there projects tend to grow organically -

Re: Destructors and Deterministic Memory Management

2009-05-05 Thread Nick B
Sean Kelly wrote: dsimcha wrote: Two closely related topics here: 1. It is often nice to be able to create a single object that works with both GC and deterministic memory management. The idea is that, if delete is called manually, all sub-objects would be freed deterministically, but the

Re: Many questions

2009-05-05 Thread Georg Wrede
Yigal Chripun wrote: *but*, I do think that splitting one file that got too big over time or uniting a bunch of small files into one should be possible. This would be especially good for us. D is mainly developed by individuals, and there projects tend to grow organically -- as opposed to the

Re: Destructors and Deterministic Memory Management

2009-05-05 Thread Daniel Keep
Sean Kelly wrote: > ... > > import core.runtime; > > interface Disposable > { > void dispose(); > } > > bool handler( Object o ) > { > auto d = cast(Disposable) o; > > if( d !is null ) > { > d.dispose(); > return false; > } > return true; > } > > stati

Re: Associative Arrays and Interior Pointers

2009-05-05 Thread bearophile
dsimcha: I can see you are working a lot to try to improve the implementation of the language. Thank you for this. > this comes at the price of worse cache performance > that can cause lookups to take up to twice as long as the current > implementation for large AAs. On the other hand, building