Re: NaCl stable ABI

2011-08-01 Thread Alex Rønne Petersen
On 01-08-2011 18:58, bearophile wrote: Google has recently set the ABI for their NaCl: http://www.reddit.com/r/programming/comments/j46sz/google_native_client_05_released_with_stable_abi/ When a language becomes usable online it gets much more visibility. I don't know if NaCl will have success

Re: NaCl stable ABI

2011-08-02 Thread Alex Rønne Petersen
On 02-08-2011 05:20, Andrej Mitrovic wrote: Maybe it's a framework for Farmville on Google Plus. :p Then we must support it! - Alex

Re: More than one invariant per struct/class

2011-08-04 Thread Alex Rønne Petersen
On 04-08-2011 11:32, simendsjo wrote: I would like to use a template mixin to add some fields to a struct, but I'd also like the template to add additional invariant checks without having to remember to add this for all struct/classes that mixes in this code. class C { int a; } mixin template E

Re: GG bug? (OS X Lion, DMD 2.054)

2011-08-04 Thread Alex Rønne Petersen
On 04-08-2011 14:09, Magnus Lie Hetland wrote: On 2011-08-03 14:57:57 +, David Nadlinger said: This seems to be exactly same problem I reported to the NG some days ago. It is caused by ASLR being enabled for 32bit applications on Lion too, and kennytm is to be credited for tracking this dow

Re: GG bug? (OS X Lion, DMD 2.054)

2011-08-04 Thread Alex Rønne Petersen
On 04-08-2011 15:21, Magnus Lie Hetland wrote: On 2011-08-04 12:27:54 +, Alex Rønne Petersen said: Hi, You can see my blog for Linux: http://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/ For others trying to do the same (i.e., compile this stuff in OS X Lion

Re: gdc setup without gcc

2011-09-01 Thread Alex Rønne Petersen
On 01-09-2011 08:35, %u wrote: I have 2 issue: 1- i can't install the package, there is problem I don't know what is it? 2-it is not updated. It would probably help to post the error... - Alex

Re: How can I get a backtrace on segfault?

2011-09-14 Thread Alex Rønne Petersen
On 14-09-2011 11:47, Jonathan M Davis wrote: On Wednesday, September 14, 2011 10:38:38 Tobias Pankrath wrote: What OS are you on? On 32-bit Linux, it should just work. On 64-bit Linux, there's a bug which makes it so that you don't get one. If you're on Windows (which I'm guessing that you'r

Re: Functions, intrinsics, flexibility

2011-09-19 Thread Alex Rønne Petersen
On 18-09-2011 21:47, Timon Gehr wrote: On 09/18/2011 08:57 PM, bearophile wrote: I don't know what is the right design in this case. Intrinsics are useful because they sometimes give more performance, but normal functions are sometimes more handy because they allow more flexibility, like taking

Re: -release compiler switch and associative arrays

2011-10-09 Thread Alex Rønne Petersen
On 09-10-2011 13:24, Graham Cole wrote: I understand from the documentation that the "-release" compiler switch turns off "array bounds checking for system and trusted functions". Is it correct that the following code should seg fault when compiled with "-release" ? string[string] h; h["abc"]

Re: An old topic (pun intended)

2011-10-16 Thread Alex Rønne Petersen
On 17-10-2011 02:43, bearophile wrote: Timon Gehr: Eiffel does not do that either. (even though it _does_ have a built in deep copy feature) We don't have to over-engineer the feature, if somebody needs to deep-copy an object they can implement it themselves and use old(obj.deepCopy()). I ag

Re: An old topic (pun intended)

2011-10-17 Thread Alex Rønne Petersen
On 17-10-2011 07:59, Davidson Corry wrote: On 10/16/2011 9:35 PM, Alex Rønne Petersen wrote: On 17-10-2011 02:43, bearophile wrote: Timon Gehr: Eiffel does not do that either. (even though it _does_ have a built in deep copy feature) We don't have to over-engineer the feature, if som

Re: Error: WndProc - nothrow

2012-09-16 Thread Alex Rønne Petersen
w shell returned 1 What does the nothrow stems from? Is this something new? nothrow is a function attribute meaning "this function does not throw exceptions". Just mark your wndProc function as nothrow and it should go away. http://dlang.org/function.html#nothrow-functions -- Alex R

Re: Best way to Identify Endianness?

2012-10-04 Thread Alex Rønne Petersen
UUID <-> GUID conversion. GUID uses Native ordering for 3 groupings. version (LittleEndian) { ... } else version (BigEndian) { ... } http://dlang.org/version.html -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: version(debug)

2012-10-06 Thread Alex Rønne Petersen
;); } } will print "yes" when you compile with -debug and "no" otherwise. - Jonathan M Davis version (assert) is a very recent addition to the compiler and is not in 2.060. -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: About demangling

2012-10-11 Thread Alex Rønne Petersen
even have a tool for that: https://github.com/D-Programming-Language/tools/blob/master/ddemangle.d -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Do we have GC-free hash map implementation sitting somewhere?

2012-10-14 Thread Alex Rønne Petersen
Hi, Is there a GC-free hash map implementation for D somewhere on the intertubes? (Preferably in a Git repository and under a liberal/non-viral license.) -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: Do we have GC-free hash map implementation sitting somewhere?

2012-10-14 Thread Alex Rønne Petersen
On 15-10-2012 08:49, Alex Rønne Petersen wrote: Hi, Is there a GC-free hash map implementation for D somewhere on the intertubes? (Preferably in a Git repository and under a liberal/non-viral license.) ... s/have/have a/ ... -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: Friends?

2012-10-19 Thread Alex Rønne Petersen
e. :| -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: Threading Question

2012-10-25 Thread Alex Rønne Petersen
at's used on OS X? I forget... -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: Why is "delete" unsafe?

2012-10-26 Thread Alex Rønne Petersen
)p; delete o; // Spot the bug. -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: Interesting C header translation problem

2012-10-30 Thread Alex Rønne Petersen
* ptr", right? Yep. For the moment, my "solution" is to just include a note saying "Don't compile the *.c files with __GNUC__ defined" ;) But what would be the best realistic way to handle these issues? Any established practices? Honestly, I don't know. I wou

Re: Callbacks and interfacing with C

2012-10-30 Thread Alex Rønne Petersen
ure the calling convention is correct. In general, calling convention is part of both the function signature and function pointer type - function pointers just default to extern (D). -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: Threading Question

2012-10-30 Thread Alex Rønne Petersen
On 30-10-2012 19:04, Sean Kelly wrote: On Oct 25, 2012, at 11:18 PM, Jacob Carlborg wrote: On 2012-10-26 01:18, Sean Kelly wrote: On Oct 25, 2012, at 4:12 PM, Alex Rønne Petersen wrote: What's used on OS X? I forget... The method used is similar to how GC works on Windows--ther

Re: vestigial delete in language spec

2012-11-01 Thread Alex Rønne Petersen
.free(a.ptr); instead. -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: no size for type nothrow extern (Windows) int()

2012-11-10 Thread Alex Rønne Petersen
function, same error. Can you give a self-contained repro that illustrates the problem? Also, please use core.sys.windows.windows instead. The std.c.* package is going to be deprecated soon-ish. -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: Unit tests and segfaults

2012-12-06 Thread Alex Rønne Petersen
#x27;t check for nulls everywhere). It's even possible to do cleanly. It's just not portable. At all. -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: AES-NI

2012-12-08 Thread Alex Rønne Petersen
On 08-12-2012 21:14, Heinz wrote: On Saturday, 8 December 2012 at 17:11:37 UTC, Alex Rønne Petersen wrote: On 08-12-2012 18:08, Heinz wrote: Hi, Are AES-NI instruction set supported by the D inline assembler? If not, can they be used by inserting raw data (the corresponding opcodes)? Does

Re: Why the lack of networky bits in the standard library

2012-12-10 Thread Alex Rønne Petersen
ne other than nobody having gotten around to it. -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: Is there a weak pointer or references in D?

2013-01-12 Thread Alex Rønne Petersen
should look? https://github.com/lycus/mci/blob/master/src/mci/core/weak.d It has some caveats (see the comments). -- Alex Rønne Petersen a...@alexrp.com / a...@lycus.org http://lycus.org

Re: Is there a weak pointer or references in D?

2013-01-13 Thread Alex Rønne Petersen
On 14-01-2013 00:18, Charles Hixson wrote: On 01/12/2013 09:24 PM, Alex Rønne Petersen wrote: On 11-01-2013 19:15, Charles Hixson wrote: I was looking for a way to create a weak reference to either a struct or a class. I need to be able to use it to automatically generate an active reference

Re: Assembly - 64-bit registers supported?

2013-01-20 Thread Alex Rønne Petersen
its registers are supported. -- Alex Rønne Petersen a...@alexrp.com / a...@lycus.org http://lycus.org

Re: odd use of preprocessor

2011-11-06 Thread Alex Rønne Petersen
On 06-11-2011 20:43, Ellery Newcomer wrote: poking about in elfutils headers, I've come across the following idiom several times /* Error values. */ enum { DW_TAG_invalid = 0 #define DW_TAG_invalid DW_TAG_invalid }; anyone know if anything strange is going on here that would preve

Re: odd use of preprocessor

2011-11-07 Thread Alex Rønne Petersen
On 06-11-2011 21:36, Ellery Newcomer wrote: On 11/06/2011 01:50 PM, Alex Rønne Petersen wrote: On 06-11-2011 20:43, Ellery Newcomer wrote: poking about in elfutils headers, I've come across the following idiom several times /* Error values. */ enum { DW_TAG_invalid = 0 #d

Re: extends and implements

2011-11-07 Thread Alex Rønne Petersen
On 07-11-2011 19:22, %u wrote: Hello. I know D isn't Java, but one trivial thing I liked about Java is the introduction of 'extends' and 'implements' as keywords as ways to clarify the class relationships when defining a class. You know: class Subclass extends SuperClass implements AnInterface

Re: assert(obj) is a mystery

2011-11-09 Thread Alex Rønne Petersen
On 09-11-2011 11:33, Jonathan M Davis wrote: On Tuesday, November 08, 2011 21:51:46 Davidson Corry wrote: OK. Not addressing Alex's objections at all, it's not clear to me why anyone would *need* to test the invariant of an object. I wouldn't expect it to be something that you'd need to do ver

Re: .Net

2011-11-09 Thread Alex Rønne Petersen
On 09-11-2011 15:54, Kagamin wrote: Reklen Wrote: Is there a project to export D in .Net world? I see this http://dnet.codeplex.com/ but it seems dead. I don't think D could be a rival to C# but i'm sure it may be interesting if it works in such enviroment. AFAIK the author tried to preserve

Re: C-style function pointers

2011-11-11 Thread Alex Rønne Petersen
On 11-11-2011 11:54, Aaron P wrote: This is a little advanced for me, but I'd rather fix that one line in a library somewhere than compile with -d. I get an error message "C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers." Can someo

Re: Asm and CTFE

2011-11-12 Thread Alex Rønne Petersen
On 12-11-2011 13:33, bearophile wrote: This code doesn't compile with the latest DMD 2.057head: import std.math: poly; enum p = poly(2.0, [-2, 3, 5]); void main() {} The error: ...\dmd2\src\phobos\std\math.d(3752): Error: asm statements cannot be interpreted at compile time test.d(2):

Re: Asm and CTFE

2011-11-12 Thread Alex Rønne Petersen
On 12-11-2011 23:51, bearophile wrote: Alex Rønne Petersen: The problem is that DMD defines *all* version identifiers regardless of whether CTFE is active. I guess it's just a matter of removing the inline assembly identifiers when doing CTFE. Do you remember why the __ctfe is a run

Re: The book "Programming in D" is in beta

2011-11-14 Thread Alex Rønne Petersen
On 14-11-2011 08:00, Ali Çehreli wrote: I have been translating my Turkish D book "D Programlama Dili" to English under the title "Programming in D". I have decided to make its current state available online: http://ddili.org/ders/d.en/index.html I will make more chapters available as they get

Make a variable single-assignment?

2011-11-21 Thread Alex Rønne Petersen
Hi, Is there any way to make a variable single-assignment, regardless of its type? I.e.: void foo() { int i = 0; i = 2; // Error: i cannot be reassigned } I realize const and immutable will do this, but they are transitive and infect the type, which I do *not* want. I simply want th

Re: Make a variable single-assignment?

2011-11-21 Thread Alex Rønne Petersen
On 21-11-2011 15:48, Trass3r wrote: Don't think so. You could also wrap it in a struct with disabled opAssign, but this would also change the type. Perhaps allowing 'final' on fields and locals would be a nice way to gain this effect... - Alex

Re: Make a variable single-assignment?

2011-11-21 Thread Alex Rønne Petersen
On 11/21/11 11:04 AM, Alex Rønne Petersen wrote: Hi, Is there any way to make a variable single-assignment, regardless of its type? I.e.: void foo() { int i = 0; i = 2; // Error: i cannot be reassigned } I realize const and immutable will do this, but they are transitive and infect the type, wh

Re: C++ vs D aggregates

2011-12-04 Thread Alex Rønne Petersen
On 03-12-2011 20:14, Dejan Lekic wrote: I recently stumbled on this thread: http://stackoverflow.com/ questions/5666321/what-is-assignment-via-curly-braces-called-and-can-it- be-controlled The important part is this: 8< - begin - The Standard says in section §8.5.1/1,

Re: Catching signals with D

2011-12-23 Thread Alex Rønne Petersen
On 22-12-2011 23:51, Matej Nanut wrote: Hello everyone, I've been fascinated by D lately and have been using it for all my school assignments (like simple ray casting and simulated annealing). What I can't find anywhere is how to do something like "signal(SIGINT, myhandler)" (I'm in a Linux envi

Re: do-while loops

2011-12-28 Thread Alex Rønne Petersen
On 28-12-2011 18:50, Timon Gehr wrote: On 12/28/2011 06:42 PM, bearophile wrote: Timon Gehr: I fully agree, but why does this go to D.learn? Because I think there's no hope to see this situation changed :-) Bye, bearophile Why? The only D code that would get broken would be code that uses

__gshared and static constructors

2012-01-04 Thread Alex Rønne Petersen
Hi, When using __gshared for variables at module level, it is my understanding that they should be initialized in the shared static this constructor. My question is: When having __gshared variables inside classes, where should I initialize these? Do classes have a shared static this construct

Re: Compile-time evaluation of real expressions?

2012-01-06 Thread Alex Rønne Petersen
On 06-01-2012 23:21, H. S. Teoh wrote: Hi All, As I understand it, compile-time execution *should* be able to evaluate floating-point functions, correct? Currently, I have this code: private static real cross_angles[6] = [ real.nan, real.nan,

Re: Compile-time evaluation of real expressions?

2012-01-06 Thread Alex Rønne Petersen
On 07-01-2012 00:37, Jonathan M Davis wrote: On Saturday, January 07, 2012 00:03:39 Alex Rønne Petersen wrote: Most likely those functions are just implemented using inline assembly, therefore not usable in CTFE. Yeah, several functions in std.math use inline assembly. So, for them to be able

Re: Compile-time evaluation of real expressions?

2012-01-07 Thread Alex Rønne Petersen
On 07-01-2012 01:31, H. S. Teoh wrote: On Sat, Jan 07, 2012 at 12:49:46AM +0100, Alex Rønne Petersen wrote: On 07-01-2012 00:37, Jonathan M Davis wrote: On Saturday, January 07, 2012 00:03:39 Alex Rønne Petersen wrote: Most likely those functions are just implemented using inline assembly

Re: How do you overload new and delete for a class?

2012-01-09 Thread Alex Rønne Petersen
On 09-01-2012 20:41, Adrian Mercieca wrote: Hi, Can someone please provide an example regarding overloading new and delete for a class? Thanks a lot. This is deprecated. What you should be doing is using std.conv.emplace() with whatever allocator (say, malloc()) you wish to use. - Alex

Bad thread_attachThis() design

2012-01-10 Thread Alex Rønne Petersen
From comments: /** * Registers the calling thread for use with the D Runtime. If this routine * is called for a thread which is already registered, the result is undefined. */ I think this is bad design. There is no good way to know if the current thread is attached to the runtime, so ho

Re: output minimal .di files?

2012-01-16 Thread Alex Rønne Petersen
On 16-01-2012 21:08, H. S. Teoh wrote: On Mon, Jan 16, 2012 at 11:38:15AM -0800, Adam Wilson wrote: [...] I would say the main reason for using .h/.di files in libraries is that the library designer does not want his implementation public viewable. And in D, unlike C/C++, .di files are pretty mu

Re: Error: 'this' is only defined in non-static member functions, not parse

2012-01-17 Thread Alex Rønne Petersen
On 17-01-2012 12:23, Matej Nanut wrote: I will try to remove all snippets in my code that aren't relevant but still exhibit the issue, when I find the time. What I forgot to mention is that this error appeared when I did some so-called "refactoring"; I moved a nested class out of its parent, sinc

Re: tdlp: higher-order functions

2012-01-20 Thread Alex Rønne Petersen
On 20-01-2012 15:32, Jerome BENOIT wrote: Hello List: In tDlp book in section 5.6 entitled `Higher-Order Functions. Function Literals, the first code example is: - T[] find(alias pred, T)(T[] input) if (is(typeof(pred(input[0])) ==

Re: tdlp: higher-order functions

2012-01-20 Thread Alex Rønne Petersen
On 20-01-2012 17:14, Jerome BENOIT wrote: Hello Again: On 20/01/12 15:58, Alex Rønne Petersen wrote: On 20-01-2012 15:32, Jerome BENOIT wrote: Hello List: In tDlp book in section 5.6 entitled `Higher-Order Functions. Function Literals, the first code example is

Re: dmd & gdc

2012-01-26 Thread Alex Rønne Petersen
On 26-01-2012 18:06, xancorreu wrote: Al 26/01/12 17:15, En/na H. S. Teoh ha escrit: On Thu, Jan 26, 2012 at 01:34:39PM +0100, Trass3r wrote: On Thursday, 26 January 2012 at 11:46:19 UTC, sami wrote: my question is if there thing i can do with dmd only and visa versa? what the feature of one o

Re: Chained Catch Statements

2012-01-30 Thread Alex Rønne Petersen
On 30-01-2012 15:37, Jared wrote: In Java and C++, I can do something to the effect of: try { //Some code } catch (Exception1) { } catch (Exception2) { } //etc... However, this doesn't seem to be possible in D. What is the idiom for handling a case where multiple exceptions of different ty

Re: Why I could not cast string to int?

2012-02-02 Thread Alex Rønne Petersen
On 02-02-2012 17:26, xancorreu wrote: Why cast(int) does not work and I have to call another function? Thanks, Al 02/02/12 17:24, En/na Adam D. Ruppe ha escrit: On Thursday, 2 February 2012 at 16:21:39 UTC, xancorreu wrote: $ ./factorial 222 Factorial requires a number args[0] is the name o

Re: Segment violation (was Re: Why I could not cast string to int?)

2012-02-03 Thread Alex Rønne Petersen
On 03-02-2012 11:08, Artur Skawina wrote: On 02/03/12 00:20, Jonathan M Davis wrote: in is pointless on value types. All it does is make the function parameter const, which really doesn't do much for you, and in some instances, is really annoying. Personally, I see no point in using in unless th

Re: Segment violation (was Re: Why I could not cast string to int?)

2012-02-03 Thread Alex Rønne Petersen
On 03-02-2012 11:41, Artur Skawina wrote: On 02/03/12 11:21, Alex Rønne Petersen wrote: On 03-02-2012 11:08, Artur Skawina wrote: On 02/03/12 00:20, Jonathan M Davis wrote: in is pointless on value types. All it does is make the function parameter const, which really doesn't do much fo

Re: About CTFE and pointers

2012-02-24 Thread Alex Rønne Petersen
On 24-02-2012 15:08, bearophile wrote: I have seen this C++11 program: http://kaizer.se/wiki/log/post/C++_constexpr/ I have translated it to this D code: bool notEnd(const char *s, const int n) { return s&& s[n]; } bool strPrefix(const char *s, const char *t, const int ns, const int nt)

Re: struct init() method

2012-02-25 Thread Alex Rønne Petersen
On 25-02-2012 05:05, bearophile wrote: This program comes from a reduction of a bug I've found: struct Foo { void init() {} } void main() { Foo*[] foos; //(*foos[0]).init(); // OK foos[0].init(); // Error: function expected before (), not null of type Foo* } What do you t

Re: Supporting and signature-checking all foreach variations

2012-02-25 Thread Alex Rønne Petersen
On 25-02-2012 17:25, Ashish Myles wrote: I want to define a general-purpose centroid computer for point containers and ran into a couple of challenges. Firstly, here is the basic code Point3 computeCentroid(PointContainer)(const ref PointContainer C) if (...)// want a signature

Re: struct init() method

2012-02-25 Thread Alex Rønne Petersen
On 26-02-2012 00:18, Jonathan M Davis wrote: On Saturday, February 25, 2012 17:07:14 Timon Gehr wrote: This is useful: struct S{ @disable enum init = 0; } I thought that the way that you were supposed to do that was @disable this(); - Jonathan M Davis Yeah, I'm not sure what purpose

Re: struct init() method

2012-02-25 Thread Alex Rønne Petersen
On 26-02-2012 02:54, Jonathan M Davis wrote: On Saturday, February 25, 2012 17:54:44 H. S. Teoh wrote: On Sun, Feb 26, 2012 at 12:23:47AM +0100, Alex Rønne Petersen wrote: On 26-02-2012 00:18, Jonathan M Davis wrote: On Saturday, February 25, 2012 17:07:14 Timon Gehr wrote: This is useful

Re: struct init() method

2012-02-26 Thread Alex Rønne Petersen
On 26-02-2012 12:53, Jonathan M Davis wrote: On Sunday, February 26, 2012 12:48:06 Timon Gehr wrote: On 02/26/2012 12:18 AM, Jonathan M Davis wrote: On Saturday, February 25, 2012 17:07:14 Timon Gehr wrote: This is useful: struct S{ @disable enum init = 0; } I thought that the way

Cocoa bindings?

2012-03-01 Thread Alex Rønne Petersen
Hi, Are there any actively-maintained Cocoa bindings for D? -- - Alex

How to indicate that a memory block contains no GC pointers?

2012-03-02 Thread Alex Rønne Petersen
Hi, Is there any way I can tell the GC that a block of memory does not contain any possible pointers (in)to other GC-managed memory? -- - Alex

Re: How to indicate that a memory block contains no GC pointers?

2012-03-02 Thread Alex Rønne Petersen
On 02-03-2012 21:54, Ali Çehreli wrote: On 03/02/2012 12:48 PM, Alex Rønne Petersen wrote: Hi, Is there any way I can tell the GC that a block of memory does not contain any possible pointers (in)to other GC-managed memory? Everything about the GC should be in the core.memory module. I

Re: [Inline assembler] Sequential `asm` blocks and return via EAX

2012-03-08 Thread Alex Rønne Petersen
On 08-03-2012 10:42, Denis Shelomovskij wrote: 1. Is there any guaranties that no code will be added between sequential inline assembler blocks, e.g.: --- void f() { static if(x) asm { mov EBX, 3; } else asm { mov EBX, 7; } asm { mov EAX, EBX; } // Is EBX value defined here? } I don't think yo

Re: [Inline assembler] Sequential `asm` blocks and return via EAX

2012-03-08 Thread Alex Rønne Petersen
On 08-03-2012 14:48, Daniel Murphy wrote: "Denis Shelomovskij" wrote in message news:jj9uv1$8o$1...@digitalmars.com... 1. Is there any guaranties that no code will be added between sequential inline assembler blocks, e.g.: --- void f() { static if(x) asm { mov EBX, 3; } else

Re: is not an lvalue

2012-03-11 Thread Alex Rønne Petersen
On 12-03-2012 01:55, Caligo wrote: With the latest DMD I've noticed that the following no longer works: struct A { int[4] _data; } struct B { ref B foo(const ref A a) { } } B b = B().foo(A([1, 2, 3, 4])); // Error: A() is not an lvalue How much of a difference is 'ref' supposed to make o

Re: What's the correct opEquals signature for structs?

2012-03-13 Thread Alex Rønne Petersen
On 13-03-2012 19:28, Johannes Pfau wrote: My std.uuid module doesn't compile with the latest dmd. I guess it's because of a wrong opEquals signature, this is what I have now: -- @safe pure nothrow bool opEquals(ref const UUID s) const { return s.data == this.data; } -- and

Re: What's the correct opEquals signature for structs?

2012-03-13 Thread Alex Rønne Petersen
On 13-03-2012 19:43, Jesse Phillips wrote: On Tuesday, 13 March 2012 at 18:28:27 UTC, Johannes Pfau wrote: My std.uuid module doesn't compile with the latest dmd. I guess it's because of a wrong opEquals signature, this is what I have now: -- @safe pure nothrow bool opEquals(ref const U

Does synchronized support recursive locking?

2012-03-13 Thread Alex Rønne Petersen
What the title says. It seems that core.sync.mutex does, but not sure about the synchronized statement. -- - Alex

Re: What's the correct opEquals signature for structs?

2012-03-13 Thread Alex Rønne Petersen
On 13-03-2012 21:39, bearophile wrote: Alex R. Petersen: (Stylistic note: use equals_t instead of bool.) What is equals_t? See it's used here: http://dlang.org/phobos/object.html Bye, bearophile It's just aliased to bool right now. -- - Alex

Re: What's the correct opEquals signature for structs?

2012-03-13 Thread Alex Rønne Petersen
On 13-03-2012 21:55, Jonathan M Davis wrote: On Tuesday, March 13, 2012 19:28:26 Johannes Pfau wrote: My std.uuid module doesn't compile with the latest dmd. I guess it's because of a wrong opEquals signature, this is what I have now: -- @safe pure nothrow bool opEquals(ref const UUID s

Re: What's the correct opEquals signature for structs?

2012-03-13 Thread Alex Rønne Petersen
On 13-03-2012 22:08, H. S. Teoh wrote: On Tue, Mar 13, 2012 at 10:02:19PM +0100, Alex Rønne Petersen wrote: On 13-03-2012 21:39, bearophile wrote: Alex R. Petersen: (Stylistic note: use equals_t instead of bool.) What is equals_t? See it's used here: http://dlang.org/phobos/object

Re: What's the correct opEquals signature for structs?

2012-03-13 Thread Alex Rønne Petersen
On 13-03-2012 23:35, bearophile wrote: Alex R. Petersen: It was an integer in the past (believe it or not). :) equals_t made the transition easier. Thank you for your answers, now I understand. Using an int makes sense for opEquals, because if opEquals doesn't get inlined then using int is s

Re: What's the correct opEquals signature for structs?

2012-03-13 Thread Alex Rønne Petersen
On 14-03-2012 01:10, Jonathan M Davis wrote: On Tuesday, March 13, 2012 22:03:45 Alex Rønne Petersen wrote: Did you see my other post? Maybe we could do something like this: equals_t opEquals()(const auto ref SysTime rhs) const pure nothrow That would probably work (though I wouldn'

Re: What's the correct opEquals signature for structs?

2012-03-13 Thread Alex Rønne Petersen
On 14-03-2012 01:18, Jonathan M Davis wrote: On Wednesday, March 14, 2012 01:14:04 Alex Rønne Petersen wrote: On 14-03-2012 01:10, Jonathan M Davis wrote: On Tuesday, March 13, 2012 22:03:45 Alex Rønne Petersen wrote: Did you see my other post? Maybe we could do something like this: equals_t

Re: What's the correct opEquals signature for structs?

2012-03-13 Thread Alex Rønne Petersen
On 14-03-2012 01:43, Andrej Mitrovic wrote: On 3/14/12, Jonathan M Davis wrote: As I understand it, auto ref is supposed to work with _any_ function. The _compiler_ decides whether it's best to use a ref or a value. I never really understood the need for 'const ref' with structures. If the co

Re: Does synchronized support recursive locking?

2012-03-14 Thread Alex Rønne Petersen
On 14-03-2012 13:24, Steven Schveighoffer wrote: On Tue, 13 Mar 2012 16:26:08 -0400, Alex Rønne Petersen wrote: What the title says. It seems that core.sync.mutex does, but not sure about the synchronized statement. Yes. A simple test would have shown you that ;) But it would be good to put

Re: Checking for possibility of implicit conversions

2012-03-14 Thread Alex Rønne Petersen
On 14-03-2012 18:07, H. S. Teoh wrote: How do I check if a given type T can be implicitly converted to some type S at compile-time? I'm trying to write a signature constraint for a template function that should only be instantiated if the parameter type can be implicitly assigned to some given ty

Re: Confused about github rebasing

2012-03-15 Thread Alex Rønne Petersen
On 15-03-2012 20:13, H. S. Teoh wrote: I'm trying to submit a pull request for druntime, but I'm running into a git problem. This is what I did: - (I forgot that my master branch is out of date) - created a new branch for the fix and committed some changes - switched to master and ran 'git pull'

Re: Confused about github rebasing

2012-03-15 Thread Alex Rønne Petersen
On 15-03-2012 21:49, H. S. Teoh wrote: On Thu, Mar 15, 2012 at 08:59:57PM +0100, Alex Rønne Petersen wrote: On 15-03-2012 20:13, H. S. Teoh wrote: I'm trying to submit a pull request for druntime, but I'm running into a git problem. This is what I did: - (I forgot that my master bra

Re: Confused about github rebasing

2012-03-15 Thread Alex Rønne Petersen
On 15-03-2012 21:53, Gour wrote: On Thu, 15 Mar 2012 13:49:14 -0700 "H. S. Teoh" wrote: Another question. How to I repair my current history, which is all messed up now? By not using DVCS which allows you to rewrite history (hint: check Fossil). ;) It's perfectly useful in DVCS. Without it

Re: Confused about github rebasing

2012-03-15 Thread Alex Rønne Petersen
On 15-03-2012 22:17, Sean Cavanaugh wrote: On 3/15/2012 3:56 PM, Alex Rønne Petersen wrote: On 15-03-2012 21:53, Gour wrote: On Thu, 15 Mar 2012 13:49:14 -0700 "H. S. Teoh" wrote: Another question. How to I repair my current history, which is all messed up now? By not using

Re: Confused about github rebasing

2012-03-15 Thread Alex Rønne Petersen
On 15-03-2012 22:37, H. S. Teoh wrote: On Thu, Mar 15, 2012 at 09:51:30PM +0100, Alex Rønne Petersen wrote: On 15-03-2012 21:49, H. S. Teoh wrote: [...] Another question. How to I repair my current history, which is all messed up now? That is, my branch has a whole bunch of commits I didn&#

rt_attachDisposeEvent

2012-03-17 Thread Alex Rønne Petersen
Hi, When using rt_attachDisposeEvent, can I rely on the Object being passed to my delegate only being the object I originally registered? Or could it, through some voodoo magic, be a different object? -- - Alex

Tail call optimization?

2012-03-18 Thread Alex Rønne Petersen
Does D to tail call optimization of any kind? -- - Alex

Re: Tail call optimization?

2012-03-19 Thread Alex Rønne Petersen
On 19-03-2012 13:07, bearophile wrote: Stewart Gordon: What are "normal cases"? It means "very simple cases". Things like fibonacci / factorial functions that call themselves at the tail. Generally it's a fragile optimization, it's easy for it to not work/stop working. LLVM used to perform

Re: std.typecons.Ref(T).opImplicitCastTo()

2012-04-01 Thread Alex Rønne Petersen
On 30-03-2012 19:28, Jonathan M Davis wrote: On Friday, March 30, 2012 16:27:44 simendsjo wrote: Is opImplicitCastTo a planned feature? It's only used in this type as I can see, and it doesn't add implicit casting. It's been discussed, but I don't think that it's ever been agreed upon. In theo

Re: std.typecons.Ref(T).opImplicitCastTo()

2012-04-01 Thread Alex Rønne Petersen
On 02-04-2012 06:25, Jonathan M Davis wrote: On Monday, April 02, 2012 05:41:00 Alex Rønne Petersen wrote: On 30-03-2012 19:28, Jonathan M Davis wrote: On Friday, March 30, 2012 16:27:44 simendsjo wrote: Is opImplicitCastTo a planned feature? It's only used in this type as I can see, a

Re: std.typecons.Ref(T).opImplicitCastTo()

2012-04-02 Thread Alex Rønne Petersen
On 02-04-2012 07:32, Jonathan M Davis wrote: On Monday, April 02, 2012 07:23:23 Alex Rønne Petersen wrote: On 02-04-2012 06:25, Jonathan M Davis wrote: alias this is not supposed to be restricted such that you can only have one per type. That's a temporary, implementation problem.

Library search path on Windows?

2012-04-12 Thread Alex Rønne Petersen
How do I pass a library search path to DMD on Windows? -- - Alex

Re: Library search path on Windows?

2012-04-12 Thread Alex Rønne Petersen
On 13-04-2012 03:10, Alex Rønne Petersen wrote: How do I pass a library search path to DMD on Windows? -L+ apparently... -- - Alex

Re: Library search path on Windows?

2012-04-13 Thread Alex Rønne Petersen
On 13-04-2012 05:25, Jesse Phillips wrote: On Friday, 13 April 2012 at 01:10:40 UTC, Alex Rønne Petersen wrote: How do I pass a library search path to DMD on Windows? I would love to know too! Only place I found was to edit sc.ini sorry. It seems that "-L+" does the trick... I

Re: Thread join behaviour

2012-04-14 Thread Alex Rønne Petersen
On 14-04-2012 18:04, Russel Winder wrote: I thought the following would terminate gracefully having printed 0..9 in some (random) order: #! /usr/bin/env rdmd import std.algorithm ; import std.range ; import std.stdio ; import core.thread ;

  1   2   >