Re: tail const ?

2014-10-30 Thread Simon A via Digitalmars-d
I don't know about syntax, but D sure needs first-class support of tail immutability. Take this code for example: --- immutable class C { void foo() { // } } void main() { auto c = new C(); c.foo(); } --- Compile it and get Error: imm

Re: struct and default constructor

2014-10-10 Thread Simon A via Digitalmars-d
On Friday, 10 October 2014 at 09:58:54 UTC, Walter Bright wrote: On 11/27/2011 11:53 AM, deadalnix wrote: I wonder why struct can't have a default constructor. TDPL state that it is required to allow every types to have a constant .init . Having a .init instead of a default constructor has al

Re: Multi-threaded GUI

2012-07-26 Thread Simon
On 26/07/2012 09:16, Russel Winder wrote: On Wed, 2012-07-25 at 23:17 +0200, Kagamin wrote: On Wednesday, 25 July 2012 at 18:50:51 UTC, Simon wrote: You have to be very, very careful with trying to do multi threading w/ windoze windows. Try doing a google search on it, and the advice is

Re: Multi-threaded GUI

2012-07-25 Thread Simon
On 25/07/2012 19:34, Gor Gyolchanyan wrote: Hi! I'm trying to write a WinAPI example to have multi-threaded GUI. I wanna have a Window class, which creates a window and listens to its messages in a separate thread when constructed. This will allow me to write a main function like this: void ma

Re: Posix vs. Windows

2012-05-18 Thread Simon
On 18/05/2012 20:41, H. S. Teoh wrote: Command shells have always been a train wreck on Windows, as far as I can remember. I haven't used Windows in any serious way for more than a decade now, so I can't speak for later versions of Windows, but I suspect things haven't changed much. This is one

Re: Class methods in D?

2012-05-04 Thread Simon
On 04/05/2012 13:27, Steven Schveighoffer wrote: On Fri, 04 May 2012 01:13:07 -0400, Mehrdad wrote: Hmm... how exactly do you use RTInfo? (Is it usable yet? All I see is a void* and a dummy template.) You have to fill in object.di's RTInfo(T) to be whatever you want. As I said, it's very bet

Re: Class methods in D?

2012-05-03 Thread Simon
On 03/05/2012 18:21, Mehrdad wrote: In Windows, you need to register a "window class" before you can actually create an instance of it. If you are mucking about on 'doze you might find my dubious port of the ATL window classes relevant: http://www.sstk.co.uk/atlWinD.php That does all that t

Re: Dynamic language

2012-03-16 Thread Simon
On 16/03/2012 02:28, Nick Sabalausky wrote: "James Miller" wrote in message news:mailman.733.1331853568.4860.digitalmar...@puremagic.com... I hate the fact that Flash games are created the way they are. For one, it's impenetrable to try and learn properly, I had so much trouble figuring out ho

Re: "Improve this page"

2012-03-16 Thread Simon
On 16/03/2012 04:27, James Miller wrote: On 16 March 2012 17:14, Brad Anderson wrote: I have a pending pull request which adds an "Improve this page" button to the upper right corner all pages on the website. From t

Re: John Carmack applauds D's pure attribute

2012-02-26 Thread Simon
On 26/02/2012 03:22, Walter Bright wrote: On 2/25/2012 4:01 PM, Simon wrote: On 25/02/2012 22:55, Walter Bright wrote: Enter C++'s shared_ptr. But that works by, for each object, allocating a *second* chunk of memory to hold the reference count. Right off the bat, you've got twi

Re: John Carmack applauds D's pure attribute

2012-02-25 Thread Simon
On 25/02/2012 22:55, Walter Bright wrote: On 2/25/2012 2:08 PM, Paulo Pinto wrote: Most standard compiler malloc()/free() implementations are actually slower than most advanced GC algorithms. Most straight up GC vs malloc/free benchmarks miss something crucial. A GC allows one to do substantia

Re: [OT] C++ tips for a D programmer

2011-08-31 Thread Simon
On 31/08/2011 13:41, Alex Rønne Petersen wrote: Whatever you do, avoid multiple inheritance like the plague. It will bite you, especially if you use pointers. - Alex I that's a little overly simplistic: Avoid multiple inheritance from classes with actual data members; do use multiple inherit

Re: Can't free memory allocated in a C DLL?

2011-08-05 Thread Simon
On 05/08/2011 19:00, Andrej Mitrovic wrote: Maybe HeapFree, MS says GlobalFree shouldn't be used anymore. You can't use HeapFree to free memory allocated by the MS crt. And even it did happen to work you've no guarantee it would continue to work in future. You always have to use the free me

Re: Is it too late to change the name of this language?

2011-06-17 Thread Simon
On 17/06/2011 21:51, Mike James wrote: "Benjamin Lindley" wrote in message news:itgemj$2p61$1...@digitalmars.com... On 6/17/2011 3:33 PM, Andrej Mitrovic wrote: The reason D is not as "searchable" as C or C++ is because D is a small community. It has absolutely nothing to do with the name. B

Re: Is it too late to change the name of this language?

2011-06-17 Thread Simon
On 17/06/2011 21:27, Jesse Phillips wrote: Benjamin Lindley Wrote: I'm new to this language, and so far, I really like it. But that name is unsearchable. Don't you guys think that hinders the language from catching on? Yes, you can search for D Programming Language, but that doesn't help fin

Re: [GSOC] more ideas

2011-03-24 Thread Simon
On 24/03/2011 21:35, Jacob Carlborg wrote: On 2011-03-24 22:16, Simon wrote: On 24/03/2011 19:39, Vladimir Panteleev wrote: On Thu, 24 Mar 2011 20:54:56 +0200, Trass3r wrote: I don't want to edit the ideas wiki page without getting another opinion, so what about: Me too - how abo

Re: [GSOC] more ideas

2011-03-24 Thread Simon
On 24/03/2011 19:39, Vladimir Panteleev wrote: On Thu, 24 Mar 2011 20:54:56 +0200, Trass3r wrote: I don't want to edit the ideas wiki page without getting another opinion, so what about: Me too - how about an image library? Being able to load/save popular image formats from/to RGB pixel arra

Re: internal representation of struct

2011-03-18 Thread Simon Buerger
On 18.03.2011 17:34, lenochware wrote: Hello, I have array of type vertex_t vertices[] where vertex_t is: struct vertex_t { float[3] xyz; ubyte[4] color; ... } Now, I would like use instead of array "float[3] xyz" "vec3f xyz", where vec3f is: struct vec3f { float x, y, z; ...some

Re: How do you debug DMD?

2011-03-14 Thread Simon
On 14/03/2011 07:20, %u wrote: You can use windbg.exe, which is in \dmd\windows\bin. Of course, you'll also need to download the Digital Mars C++ compiler from http://www.digitalmars.com/download/freecompiler.html Hm... I already have WinDbg (and DMC), but I never thought it's any more efficien

context-free grammar

2011-03-04 Thread Simon Buerger
It is often said that D's grammar is easier to parse than C++, i.e. it should be possible to seperate syntactic and semantic analysis, which is not possible in C++ with the template-"< >" and so on. But I found following example: The Line "a * b = c;" can be interpreted in two ways: -> Declara

Re: Should conversion of mutable return value to immutable allowed?

2011-02-24 Thread Simon Buerger
On 24.02.2011 19:08, Ali Çehreli wrote: Implicit conversions to immutable in the following two functions feel harmless. Has this been discussed before? string foo() { char[] s; return s; // Error: cannot implicitly convert expression // (s) of type char[] to string } string bar() { char[] s; re

Re: How to do Generic Programming in D?

2011-02-23 Thread Simon
On 23/02/2011 17:22, Nick wrote: On 2/23/2011 12:35 AM, Andrei Alexandrescu wrote: Andrei Thanks for all your replies! I was not sure about mixins: the template ones had a little warning in the book as being mostly experimental, and the string mixins, while powerful, seemed to me something c

Re: toHash /opCmp for builtin-types

2011-02-21 Thread Simon Buerger
sadly no: (-30) - (30) = -170532704 which is incorrect. It does however work for short/byte (and opCmp still returning int). oops, wrong example. It is: (-20) - (20) = 294967296, sry. Anyway, you see the point with overflows

Re: toHash /opCmp for builtin-types

2011-02-21 Thread Simon Buerger
On 21.02.2011 21:22, Daniel Gibson wrote: Am 21.02.2011 20:59, schrieb Simon Buerger: Following came to my mind while coding some generic collection classes: The toHash and opCmp operations are not supported for builtin-types though their implementation is trivial. * toHash The code is already

toHash /opCmp for builtin-types

2011-02-21 Thread Simon Buerger
Following came to my mind while coding some generic collection classes: The toHash and opCmp operations are not supported for builtin-types though their implementation is trivial. * toHash The code is already there inside TypeInfo.getHash. But typeid(value).getHash(&value) is much uglier than

Re: float equality

2011-02-19 Thread Simon Buerger
On 19.02.2011 13:06, spir wrote: Hello, What do you think of this? unittest { assert(-1.1 + 2.2 == 1.1); // pass assert(-1.1 + 2.2 + 3.3 == 4.4); // pass assert(-1.1 + 3.3 + 2.2 == 4.4); // fail assert(-1.1 + 3.3 == 2.2); // fail } There is approxEquals in stdlib, right; but shouldn't builtin

Re: Decision on container design

2011-02-01 Thread Simon Buerger
On 01.02.2011 20:01, Michel Fortin wrote: On 2011-02-01 12:07:55 -0500, Andrei Alexandrescu said: With this, the question becomes a matter of choosing the right default: do we want values most of the time and occasional references, or vice versa? I think most of the time you need references, a

Re: Decision on container design

2011-02-01 Thread Simon Buerger
On 01.02.2011 18:08, Steven Schveighoffer wrote: On Tue, 01 Feb 2011 11:44:36 -0500, Michel Fortin wrote: On 2011-02-01 11:12:13 -0500, Andrei Alexandrescu said: On 1/28/11 8:12 PM, Michel Fortin wrote: On 2011-01-28 20:10:06 -0500, "Denis Koroskin" <2kor...@gmail.com> said: Unfortunatel

Re: Decision on container design

2011-01-31 Thread Simon Buerger
nitely take a closer look later. Thx for mentioning. On 31.01.2011 19:09, Steven Schveighoffer wrote: On Mon, 31 Jan 2011 12:48:06 -0500, Simon Buerger wrote: On 31.01.2011 17:53, Steven Schveighoffer wrote: http://www.dsource.org/projects/dcollections -Steve Well, seems not bad on a quick

Re: Decision on container design

2011-01-31 Thread Simon Buerger
On 31.01.2011 17:53, Steven Schveighoffer wrote: http://www.dsource.org/projects/dcollections -Steve Well, seems not bad on a quick look. But source is updated 2 years ago, so I doubt it would compile with current dmd. Anyway, the topic here is the std-behaviour of the std-lib. But sure, alw

Re: "Internal error: backend\cod1.c 1895" when trying to build DMD/Druntime/Phobos from source

2011-01-30 Thread Simon
On 30/01/2011 18:54, Simon wrote: On 30/01/2011 18:29, Walter Bright wrote: Vladimir Panteleev wrote: DMC, and latest git. (The problem was there a few months ago, so it's not a recent regression.) I compile it every day, and do not see those errors. Sound like use off uninitialise

Re: "Internal error: backend\cod1.c 1895" when trying to build DMD/Druntime/Phobos from source

2011-01-30 Thread Simon
On 30/01/2011 18:29, Walter Bright wrote: Vladimir Panteleev wrote: DMC, and latest git. (The problem was there a few months ago, so it's not a recent regression.) I compile it every day, and do not see those errors. Sound like use off uninitialised var, as it's environment dependent. There

Re: "Internal error: backend\cod1.c 1895" when trying to build DMD/Druntime/Phobos from source

2011-01-30 Thread Simon
On 30/01/2011 01:11, Vladimir Panteleev wrote: I'm trying to build DMD, Druntime and Phobos from source. The resulting dmd.exe fails to compile Phobos with the error "Internal error: backend\cod1.c 1895". It seems to be dependent on my environment... I tried building it in a virtual machine, an

Re: Decision on container design

2011-01-29 Thread Simon Buerger
On 28.01.2011 19:31, Andrei Alexandrescu wrote: 1. Containers will be classes. 2. Most of the methods in existing containers will be final. It's up to the container to make a method final or not. 3. Containers and their ranges decide whether they give away references to their objects. Sealing i

Re: repeat

2011-01-17 Thread Simon Buerger
On 18.01.2011 01:24, spir wrote: On 01/17/2011 07:57 PM, Daniel Gibson wrote: IMHO * (multiply) is not good because in theoretical computer science multiply is used to concatenate two words and thus concatenating a word with itself n times is word^n (pow(word, n) in mathematical terms). Weird.

Re: RFC: SI Units facility for Phobos

2011-01-01 Thread Simon
On 01/01/2011 20:24, Andrei Alexandrescu wrote: * In the proposed design the user can define a lot of distinct types, such as Miles, Yards, and Lbs, which are strictly unnecessary (Kilometers, Meters, and Kilograms could be used instead, with appropriate I/O conversions to and from other units)

Re: improvement request - enabling by-value-containers

2010-12-22 Thread Simon Buerger
On 21.12.2010 18:45, Bruno Medeiros wrote: On 09/12/2010 21:55, Simon Buerger wrote: From a pragmatic viewpoint you are right, copying containers is rare. But on the other hand, classes imply a kind of identity, so that a set is a different obejct then an other object with the very same

Re: Paralysis of analysis

2010-12-14 Thread Simon Buerger
On 14.12.2010 20:53, Andrei Alexandrescu wrote: Coming from an STL background I was also very comfortable with the notion of value. Walter pointed to me that in the STL what you worry about most of the time is to _undo_ the propensity of objects getting copied at the drop of a hat. For example, t

Re: Paralysis of analysis

2010-12-14 Thread Simon Buerger
On 14.12.2010 20:02, Andrei Alexandrescu wrote: I kept on literally losing sleep about a number of issues involving containers, sealing, arbitrary-cost copying vs. reference counting and copy-on-write, and related issues. This stops me from making rapid progress on defining D containers and other

Re: ACCEPTED: std.datetime

2010-12-11 Thread Simon
On 11/12/2010 00:38, Andrei Alexandrescu wrote: The std.datetime Phobos submission has been accepted with a landslide vote that is usually seen only in North Korea. Many thanks to Jonathan for the hard work, and to everybody who helped him knocking this into good shape. Jonathan, please send me

Re: improvement request - enabling by-value-containers

2010-12-09 Thread Simon Buerger
On 09.12.2010 23:39, Jesse Phillips wrote: Simon Buerger Wrote: vector!int row = [1,2,3]; auto vec = Vector!(Vector!int)(5, row); then vec should be 5 rows, and not 5 times the same row. Why? You put row in there and said there was 5 of them. vec[] = row.dup; I believe that would be the

Re: improvement request - enabling by-value-containers

2010-12-09 Thread Simon Buerger
On 08.12.2010 23:45, Jonathan M Davis wrote: On Wednesday, December 08, 2010 14:14:57 Simon Buerger wrote: For Every lib its a design descision if containers should be value- or reference-types. In C++ STL they are value-types (i.e. the copy-constructor does a real copy), while in tango and

improvement request - enabling by-value-containers

2010-12-08 Thread Simon Buerger
For Every lib its a design descision if containers should be value- or reference-types. In C++ STL they are value-types (i.e. the copy-constructor does a real copy), while in tango and phobos the descision was to go for reference-types afaik, but I would like to be able to write value-types too

Re: [review] new string type

2010-12-03 Thread Simon
On 03/12/2010 18:29, Steven Schveighoffer wrote: On Fri, 03 Dec 2010 11:15:36 -0500, spir wrote: Indexing a string is rare, unless you are parsing something (yes it does truly depend on the domain), In my XP you never index *especially* when parsing. Every parser I've written & used treats in

dmg for Snow Leopard x86_64 ?

2009-09-06 Thread simon
Was just wondering if there were plans to create a Snow Leopard build of D 2.0?

Re: Functions with package protection

2009-06-02 Thread Simon TRENY
public? (e.g. a 'virtual' keyword?) Thanks, Simon TRENY Jacob Carlborg Wrote: > In the D documentation at http://www.digitalmars.com/d/1.0/function.html > it says the following: "All non-static non-private non-template member > functions are virtual", but this seems not

Re: X11 binding, XGetWindowProperty, and different behaviour for similar code between D and C++ (D fails)

2009-04-02 Thread Simon Gomizelj
On Fri, 03 Apr 2009 13:33:21 -0400, Simon Gomizelj wrote: On Thu, 02 Apr 2009 09:59:55 -0400, Jarrett Billingsley wrote: On Fri, Apr 3, 2009 at 4:40 AM, Simon Gomizelj wrote: On Fri, 03 Apr 2009 04:09:25 -0400, Simon Gomizelj wrote: As a personal learning D/learn X11 project, I

Re: X11 binding, XGetWindowProperty, and different behaviour for similar code between D and C++ (D fails)

2009-04-02 Thread Simon Gomizelj
On Thu, 02 Apr 2009 09:59:55 -0400, Jarrett Billingsley wrote: On Fri, Apr 3, 2009 at 4:40 AM, Simon Gomizelj wrote: On Fri, 03 Apr 2009 04:09:25 -0400, Simon Gomizelj wrote: As a personal learning D/learn X11 project, I thought it would be interesting to try to port dwm over to D

Re: Stack tracing on Linux ?

2009-04-02 Thread Simon Gomizelj
On Thu, 02 Apr 2009 04:56:46 -0400, Georg Wrede wrote: With gdb I can either debug a core dump or an actual running process. For example, with import std.stdio; int main() { readWrite(); return 8; } void readWrite() { auto line = readln(); // here it waits, and that's when

Re: X11 binding, XGetWindowProperty, and different behaviour for

2009-04-02 Thread Simon Gomizelj
On Thu, 02 Apr 2009 05:08:33 -0400, bearophile wrote: Simon Gomizelj: I don't like this: cast(long)*p : -1; In C you may need to use an union to perform that cast safely. Bye, bearophile I agree it's ugly, but I'm starting with a straight port. It will get cleaned up. T

Re: X11 binding, XGetWindowProperty, and different behaviour for similar code between D and C++ (D fails)

2009-04-02 Thread Simon Gomizelj
On Fri, 03 Apr 2009 04:09:25 -0400, Simon Gomizelj wrote: As a personal learning D/learn X11 project, I thought it would be interesting to try to port dwm over to D. Building it up nice and slowly, right now I'm trying to collect a list of windows and their states a-la dwm.c code.

Re: Time to invent a different file format to hold meta data info

2009-04-02 Thread Simon Gomizelj
On Mon, 30 Mar 2009 02:09:28 -0400, Unknown W. Brackets wrote: Check out clang. LLVM frontend for C, C++, and Objective-C which has similar IDE intergration in mind. Maybe ldc can take this route? Actually, I think it would be much more fruitful to have a standard way to integrate a comp

X11 binding, XGetWindowProperty, and different behaviour for similar code between D and C++ (D fails)

2009-04-02 Thread Simon Gomizelj
As a personal learning D/learn X11 project, I thought it would be interesting to try to port dwm over to D. Building it up nice and slowly, right now I'm trying to collect a list of windows and their states a-la dwm.c code. The D code, which is translated from C code, does not work, it retu

Keeping a list of instances and garbage-collection

2009-03-29 Thread Simon TRENY
d by the static list, they are never garbage-collected, which could be a problem. In some other languages, this can be solved using weak references, but I haven't found any informations about using weak references in D. Is there any way to solve this problem? Thanks, Simon

Re: Returning a struct by reference

2009-03-21 Thread Simon TRENY
grauzone Wrote: > Simon TRENY wrote: > > grauzone Wrote: > > > >> Simon TRENY wrote: > >>> Hi there! > >>> > >>> I'm quite new at D and I'm still just playing with it, but there is a > >>> thing that I find curren

Re: Returning a struct by reference

2009-03-21 Thread Simon TRENY
Daniel Keep Wrote: > > > Simon TRENY wrote: > > Ok, but then, what if I'd like to make the variable "read-only"? i.e. > > preventing the user from writing things like this: > > myObject.position = pos2; > > > > So... you're rejectin

Re: Returning a struct by reference

2009-03-21 Thread Simon TRENY
grauzone Wrote: > Simon TRENY wrote: > > Hi there! > > > > I'm quite new at D and I'm still just playing with it, but there is a thing > > that I find currently missing. Sometimes, I'd like to be able to return a > > struct by reference and not

Returning a struct by reference

2009-03-21 Thread Simon TRENY
position of the object, which I wouldn't like with this syntax. Actually, I'd like to be able to do a thing like this: public ref Position position() { return m_position; } which would be the equivalent form to passing structs by reference in a parameter. Is there a way to do this in D? Regards, Simon

Re: important proposal: scope keyword for class members

2009-03-11 Thread John Simon
Sean Kelly Wrote: > John Simon wrote: > > > > Oh man I've tried, believe me. > > I couldn't figure out how to call the destructors in-place. Also, structs > > can't have parameter-less constructors > > Have you tried just calling delete on the

Re: important proposal: scope keyword for class members

2009-03-09 Thread John Simon
Denis Koroskin Wrote: > On Sat, 07 Mar 2009 08:15:59 +0300, John Simon wrote: > > > I'd like to propose a new use for the 'scope' keyword within an > > aggregate body. > > > > Members of class type declared with the scope keyword are alloc

Re: important proposal: scope keyword for class members

2009-03-09 Thread John Simon
Yigal Chripun Wrote: > On 09/03/2009 00:12, John Simon wrote: > > Sean Kelly Wrote: > > > >> John Simon wrote: > >>> Sean Kelly Wrote: > >>>> Oh, I should mention that I'm not sure how the compiler would > >>>> handle this sc

Re: important proposal: scope keyword for class members

2009-03-08 Thread John Simon
Sean Kelly Wrote: > John Simon wrote: > > Sean Kelly Wrote: > >> > >> Oh, I should mention that I'm not sure how the compiler would handle > >> this scenario: > >> > >> class A { byte[16]; } > >> class B { byte[32]; } >

Re: important proposal: scope keyword for class members

2009-03-07 Thread John Simon
Sean Kelly Wrote: > Sean Kelly wrote: > > John Simon wrote: > >> I'd like to propose a new use for the 'scope' keyword within an > >> aggregate body. > >> > >> Members of class type declared with the scope keyword are allocated > &g

Re: important proposal: scope keyword for class members

2009-03-07 Thread John Simon
Christopher Wright Wrote: > John Simon wrote: > > You can always upcast and downcast safely, since it isn't actually a > > 'value' type, only the address is passed around. The type of the class > > remains intact. > > Right, but a scope variable has i

Re: important proposal: scope keyword for class members

2009-03-07 Thread John Simon
Christopher Wright Wrote: > dsimcha wrote: > > But the whole point of classes is that they're supposed to be polymorphic. > > If you > > don't need polymorphism, that's what structs are for. You can store them > > either > > inline (default) or in separate heap space (using pointers). If you

important proposal: scope keyword for class members

2009-03-06 Thread John Simon
I'd like to propose a new use for the 'scope' keyword within an aggregate body. Members of class type declared with the scope keyword are allocated not as references or pointers, but initialized directly inside the container. Instead of a default initializer of 'null', it will initialize with t

Re: Linking DMD D objects together with Cygwin GCC

2008-11-11 Thread Simon
> You'd probably be better off using GDC for Windows. It uses MinGW and > outputs the same COFF objects that Cygwin's GCC uses. I found the current GDC buggy (see the open bug list) and the developing progress is quite slow, not many updates not even once in 2008. So I try to stick with DMD. I h