Sorting after map

2010-10-19 Thread clueless
Hi. I want to have a sorted result of map-function, that is (in pseudocode): sorted(map!(fun)(arr)) How can I do that? I have tried something like: auto s = map!(fun)(arr); //sort(s); //sort(s[]); //sort(s.dup); writeln(s); but without success. Thanks in advance.

Re: exception types & objects

2010-10-19 Thread Jonathan M Davis
On Tuesday, October 19, 2010 12:36:23 Stewart Gordon wrote: > On 19/10/2010 13:13, spir wrote: > > > > The example uses an Excpetion type, but the somewhat comment > > contradicts it. Can one really use any kind of object as exception? > > Yes. > > > How does D then handle it? > > The mechanis

Re: C structs

2010-10-19 Thread Stanislav Blinov
Lutger wrote: Mafi wrote: Hello, I'm trying to write some SDL wrapper. After a long fight against objconv, implib and optlink I finally got SDL loading. Have you tried Derelict? (dsource.org/projects/derelict). There is a branch called Derelict2 which is D2-compatible. Derelict does not re

Re: C structs

2010-10-19 Thread Lutger
Mafi wrote: > Hello, > I'm trying to write some SDL wrapper. After a long fight against > objconv, implib and optlink I finally got SDL loading. Hurray! Now I'm > going to write a wrapper for SDL_Surface. I will only use surface > poiters so my questions is if I can safely put these pointers into

C structs

2010-10-19 Thread Mafi
Hello, I'm trying to write some SDL wrapper. After a long fight against objconv, implib and optlink I finally got SDL loading. Hurray! Now I'm going to write a wrapper for SDL_Surface. I will only use surface poiters so my questions is if I can safely put these pointers into class instances wh

Re: exception types & objects

2010-10-19 Thread Stewart Gordon
On 19/10/2010 13:13, spir wrote: The example uses an Excpetion type, but the somewhat comment contradicts it. Can one really use any kind of object as exception? Yes. How does D then handle it? The mechanism is class-agnostic. The only thing it relies on is that it's an object of some cl

Re: exception types & objects

2010-10-19 Thread div0
On 19/10/2010 20:03, Denis Koroskin wrote: On Tue, 19 Oct 2010 22:54:33 +0400, Kagamin wrote: spir Wrote: The example uses an Excpetion type, but the somewhat comment contradicts it. Can one really use any kind of object as exception? ps it's fun to throw strings in javascript, try it. :3

Re: exception types & objects

2010-10-19 Thread Denis Koroskin
On Tue, 19 Oct 2010 22:54:33 +0400, Kagamin wrote: spir Wrote: The example uses an Excpetion type, but the somewhat comment contradicts it. Can one really use any kind of object as exception? ps it's fun to throw strings in javascript, try it. :3 I've been throwing const char* in C++: t

Re: exception types & objects

2010-10-19 Thread Kagamin
spir Wrote: > The example uses an Excpetion type, but the somewhat comment contradicts it. > Can one really use any kind of object as exception? ps it's fun to throw strings in javascript, try it. :3

Re: exception types & objects

2010-10-19 Thread Kagamin
spir Wrote: > I was expecting (from exp with other language) there to be a root Error or > Exception type implementating base exception mechanics and/or an imposed > interface to comply with (esp a kind of string method returning what text to > write out when the exception is not caught). Exce

Re: implib crashing with .def files

2010-10-19 Thread Kagamin
Andrej Mitrovic Wrote: > That's ok, using the DLL with implib works, but crashing is never nice. > > I don't think coffimplib is available for download however? it's in that same ftp directory, though I don't know, whether it's piracy or not, lol.

Re: exception types & objects

2010-10-19 Thread spir
On Tue, 19 Oct 2010 14:52:20 +0200 "Simen kjaeraas" wrote: > > I was expecting (from exp with other language) there to be a root Error > > or Exception type implementating base exception mechanics and/or an > > imposed interface to comply with (esp a kind of string method returning > > what

Re: Replacement for C++ Style Implicit casts?

2010-10-19 Thread Mike Chaten
Thanks for all your help! -Mike On Mon, Oct 18, 2010 at 6:21 PM, Simen kjaeraas wrote: > Mike Chaten wrote: > > I was under the impression that alias this just was shorthand for >> Class Foo { >> int x; >> alias x this; >> } >> Foo foo = new Foo >> foo = 9; // foo.x = 9 >> Foo Foo = 9 // null

Re: exception types & objects

2010-10-19 Thread Simen kjaeraas
spir wrote: Hello, The reference states: ThrowStatement: throw Expression ; Expression is evaluated and must be an Object reference. The Object reference is thrown as an exception. throw new Exception("message"); The example uses an Excpetion type, but the somewhat comment

exception types & objects

2010-10-19 Thread spir
Hello, The reference states: ThrowStatement: throw Expression ; Expression is evaluated and must be an Object reference. The Object reference is thrown as an exception. throw new Exception("message"); The example uses an Excpetion type, but the somewhat comment contradicts it.