Re: D/Objective-C 64bit

2014-11-19 Thread Christian Schneider via Digitalmars-d-announce
I forgot to ask, do you have a small test case showing this problem? Without windows or any other fancy stuff. Just setup a small temporary repository for this: https://github.com/DiveFramework/FixingNSRect Without an OSX application with windows et al, it won't show you the send bug

On the meaning of string.length

2014-11-19 Thread Adam D. Ruppe via Digitalmars-d-announce
I answered a random C# stackoverflow question about why string.length returns the value it does with some rationale defending code units instead of characters - basically, I typed up a defense of D's string-as-array behavior. To my surprise, my answer got an enormous number of votes* so I

Re: On the meaning of string.length

2014-11-19 Thread Upvoter via Digitalmars-d-announce
On Wednesday, 19 November 2014 at 14:33:05 UTC, Adam D. Ruppe wrote: I answered a random C# stackoverflow question about why string.length returns the value it does with some rationale defending code units instead of characters - basically, I typed up a defense of D's string-as-array behavior.

Re: Endovena: a dependency injection framework.

2014-11-19 Thread George Sapkin via Digitalmars-d-announce
On Friday, 17 October 2014 at 22:55:24 UTC, Orfeo wrote: Hi all, I'd like to announce the initial version of endovena, a dependency injection framework. It's based on dejector, a great work by Jakub Stasiak, with some new features borrowed from dryioc (C# IoC) I would be glad to see any

Re: Endovena: a dependency injection framework.

2014-11-19 Thread o3o via Digitalmars-d-announce
Am I missing something or is this a Service Locator anti-pattern? More about it here: http://blog.ploeh.dk/2010/02/03/ServiceLocatorisanAnti-Pattern/ Service Locator is *really* an anti-pattern, but endovena (and also dejector) is a Dependency Injector (DI) framework, opposite of Service

Re: On the meaning of string.length

2014-11-19 Thread Ary Borenszweig via Digitalmars-d-announce
On 11/19/14, 11:33 AM, Adam D. Ruppe wrote: I answered a random C# stackoverflow question about why string.length returns the value it does with some rationale defending code units instead of characters - basically, I typed up a defense of D's string-as-array behavior. In Ruby `length` returns

Re: On the meaning of string.length

2014-11-19 Thread Walter Bright via Digitalmars-d-announce
On 11/19/2014 7:06 AM, Upvoter wrote: On Wednesday, 19 November 2014 at 14:33:05 UTC, Adam D. Ruppe wrote: I think the auto decoding in phobos was and is a mistake. I agree when you say auto decoding is a good choice. Uh-oh!

Re: GTKD2 GValue Type

2014-11-19 Thread Sergey via Digitalmars-d
On Wednesday, 19 November 2014 at 07:34:45 UTC, Kagamin wrote: Try to see what members GValue has, then it should be obvious. How to do it? GValue ggg; writeln(ggg); answer: GValue(INVALID, Data, Data) ?

Re: Would you trade 0.1% in performance for a better debugging experience?

2014-11-19 Thread Kagamin via Digitalmars-d
On Tuesday, 18 November 2014 at 18:55:43 UTC, Marco Leise wrote: Is it fair if I argue that fixing DWARF info generation is a better solution then? I'm afraid, DWARF is not designed to unwind segfaults, it works only with DWARF exceptions.

Documentation of DList in std.container seems to be inaccurate

2014-11-19 Thread Koz Ross via Digitalmars-d
I just spent a good while debugging something which arose as a result of the documentation of the DList's removeAny function. More precisely, it seems that removeAny removes from the *back*, rather than the front, as the documentation would indicate. To quote the relevant page

Re: Would you trade 0.1% in performance for a better debugging experience?

2014-11-19 Thread Kagamin via Digitalmars-d
On Tuesday, 18 November 2014 at 17:15:13 UTC, Vladimir Panteleev wrote: Second, there's still the argument that not every debugger and profiler can take advantage of the DWARF debug information. It's certainly nowhere as easy: from the technical point of view, but also from a legal one,

Re: GTKD2 GValue Type

2014-11-19 Thread Sergey via Digitalmars-d
On Wednesday, 19 November 2014 at 08:25:59 UTC, Kagamin wrote: If they are documented, see docs, otherwise see source. source: /** * A variant of gtk_list_store_set_valist() which * takes the columns and values as two arrays, instead of * varargs. This function is

Re: GTKD2 GValue Type

2014-11-19 Thread Kagamin via Digitalmars-d
Also examples and unittests can show, how to use it.

Re: GTKD2 GValue Type

2014-11-19 Thread Kagamin via Digitalmars-d
If they are documented, see docs, otherwise see source.

Re: GTKD2 GValue Type

2014-11-19 Thread Kagamin via Digitalmars-d
Why would you look for source of setValuesv when you don't know how to create GValue in the first place?

Re: Invariant for default construction

2014-11-19 Thread Daniel Murphy via Digitalmars-d
Rainer Schuetze wrote in message news:m4eu6v$trq$1...@digitalmars.com... I remember having an invariant on a tree structure checking consistency by verifying the children and parent references. This crashed when adding a destructor. With the proposed change it will always crash. The problem

Re: Why is `scope` planned for deprecation?

2014-11-19 Thread via Digitalmars-d
On Wednesday, 19 November 2014 at 00:04:50 UTC, Walter Bright wrote: I know you're simply being argumentative when you defend VLAs, a complex and useless feature, and denigrate simple ptr/length pairs as complicated. Wait, we are either discussing the design goals of the original C or the

Re: Why is `scope` planned for deprecation?

2014-11-19 Thread via Digitalmars-d
On Wednesday, 19 November 2014 at 01:35:19 UTC, Alo Miehsof Datsørg wrote: Argumentative ?!! More like a fucking gaping fucking asshole. His posts are the blight of this group. If you are going ad hominem, please post under your own name. I never go ad hominem, and therefore your response

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Frank Like via Digitalmars-d
Clearly size_t (which I tend to alias with ℕ in my code for brevity and coolness) can express more than 2^31-1 items, which is appropriate to reflect the increase in usable memory per application on 64-bit platforms. Yes, the 64-bit version of a program or library can handle larger data sets.

Re: Why is `scope` planned for deprecation?

2014-11-19 Thread via Digitalmars-d
On Wednesday, 19 November 2014 at 01:13:04 UTC, deadalnix wrote: There are good answer to most of this but most importantly, this do not contain anything actionable and is completely off topic( reminder, the topic of the thread is SCOPE ). The topic is if scope is planned for deprecation. That

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Don via Digitalmars-d
On Tuesday, 18 November 2014 at 18:23:52 UTC, Marco Leise wrote: Am Tue, 18 Nov 2014 15:01:25 + schrieb Frank Like 1150015...@qq.com: but now ,'int' is enough for use,not huge and not small,only enough. 'int' is easy to write,and most people are used to it. Most importantly easier to

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Wednesday, 19 November 2014 at 09:06:16 UTC, Maroc Leise wrote: Clearly size_t (which I tend to alias with ℕ in my code for brevity and coolness) No, this is far from the implied infinite set. A much better candidate for ℕ is BigUInt (and ℤ for BigInt)

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Kagamin via Digitalmars-d
On Tuesday, 18 November 2014 at 18:03:35 UTC, ketmar via Digitalmars-d wrote: On Tue, 18 Nov 2014 17:59:04 + David Eagen via Digitalmars-d digitalmars-d@puremagic.com wrote: Isn't the purpose of size_t is to be large enough to address all available memory? A negative value is not only

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Kagamin via Digitalmars-d
On Tuesday, 18 November 2014 at 18:23:52 UTC, Marco Leise wrote: Aside from the size factor, I personally prefer unsigned types for countable stuff like array lengths. Mixed arithmetics decay to unsinged anyways and you don't need checks like `assert(idx = 0)`. Failing assert(-1 arr.length)

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Kagamin via Digitalmars-d
On Tuesday, 18 November 2014 at 18:23:52 UTC, Marco Leise wrote: Mixed arithmetics decay to unsinged anyways and you don't need checks like `assert(idx = 0)`. What such assert gets you, what bound checking doesn't?

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Matthias Bentrup via Digitalmars-d
On Wednesday, 19 November 2014 at 10:03:35 UTC, Don wrote: On Tuesday, 18 November 2014 at 18:23:52 UTC, Marco Leise wrote: Am Tue, 18 Nov 2014 15:01:25 + schrieb Frank Like 1150015...@qq.com: but now ,'int' is enough for use,not huge and not small,only enough. 'int' is easy to

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread John Colvin via Digitalmars-d
On Wednesday, 19 November 2014 at 11:04:05 UTC, Matthias Bentrup wrote: On Wednesday, 19 November 2014 at 10:03:35 UTC, Don wrote: On Tuesday, 18 November 2014 at 18:23:52 UTC, Marco Leise wrote: Am Tue, 18 Nov 2014 15:01:25 + schrieb Frank Like 1150015...@qq.com: but now ,'int' is

Re: Program logic bugs vs input/environmental errors

2014-11-19 Thread Bruno Medeiros via Digitalmars-d
On 09/11/2014 21:33, Walter Bright wrote: On 11/7/2014 7:00 AM, Bruno Medeiros wrote: Let me give an example: double sqrt(double num) { assert(num = 0); ... With just this, then purely from a compiler/language viewpoint, if the assert is triggered the *language* doesn't know if the

Re: Would you trade 0.1% in performance for a better debugging experience?

2014-11-19 Thread w0rp via Digitalmars-d
I am personally willing to pay the small performance cost for better debugging information.

Re: GSOC Summer 2015 - Second call for Proposals

2014-11-19 Thread Bruno Medeiros via Digitalmars-d
On 05/11/2014 03:54, Craig Dillabaugh wrote: This is my second Call for Proposals for the 2015 Google Summer of Code. Anyone interested in mentoring, or who has good idea's for a project for 2015 please post here. So far I have the following people who have expressed interest in mentoring:

Re: GTKD2 GValue Type

2014-11-19 Thread via Digitalmars-d
On Wednesday, 19 November 2014 at 02:50:40 UTC, Sergey wrote: Hello everyone! I try to use gtkd + d in production, and of course I started with gtk.TreeView and gtk.ListStore objects. But I encounter a problem with GValyue type: GValue[] array_values =

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread ketmar via Digitalmars-d
On Wed, 19 Nov 2014 10:03:34 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: No! No! No! This is completely wrong. Unsigned does not mean positive. It means no sign, and therefore wrapping semantics. eg length - 4 0, if length is 2. Weird consequence: using subtraction

Re: GTKD2 GValue Type

2014-11-19 Thread ketmar via Digitalmars-d
On Wed, 19 Nov 2014 12:33:17 + via Digitalmars-d digitalmars-d@puremagic.com wrote: D doesn't allow construction from a different type with the `Type name = value;` syntax. Try this: har-har... here comes the power of the dark side! struct S { bool filler; // just in case, to avoid

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Don via Digitalmars-d
On Wednesday, 19 November 2014 at 11:43:38 UTC, John Colvin wrote: On Wednesday, 19 November 2014 at 11:04:05 UTC, Matthias Bentrup wrote: On Wednesday, 19 November 2014 at 10:03:35 UTC, Don wrote: On Tuesday, 18 November 2014 at 18:23:52 UTC, Marco Leise wrote: Am Tue, 18 Nov 2014 15:01:25

Re: GTKD2 GValue Type

2014-11-19 Thread via Digitalmars-d
On Wednesday, 19 November 2014 at 13:31:16 UTC, ketmar via Digitalmars-d wrote: On Wed, 19 Nov 2014 12:33:17 + via Digitalmars-d digitalmars-d@puremagic.com wrote: D doesn't allow construction from a different type with the `Type name = value;` syntax. Try this: har-har... here comes the

Re: GSOC Summer 2015 - Second call for Proposals

2014-11-19 Thread CraigDillabaugh via Digitalmars-d
On Wednesday, 19 November 2014 at 12:18:48 UTC, Bruno Medeiros wrote: On 05/11/2014 03:54, Craig Dillabaugh wrote: This is my second Call for Proposals for the 2015 Google Summer of Code. Anyone interested in mentoring, or who has good idea's for a project for 2015 please post here. So far I

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread ketmar via Digitalmars-d
On Wed, 19 Nov 2014 13:33:21 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: No. Signed types do not *wrap*. They *overflow* if their range is exceeded. same for unsigned ints. This is not the same thing. Overflow is always an error. And the compiler could insert checks to

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Don via Digitalmars-d
On Tuesday, 18 November 2014 at 18:03:35 UTC, ketmar via Digitalmars-d wrote: On Tue, 18 Nov 2014 17:59:04 + David Eagen via Digitalmars-d digitalmars-d@puremagic.com wrote: Isn't the purpose of size_t is to be large enough to address all available memory? A negative value is not only

Re: GTKD2 GValue Type

2014-11-19 Thread ketmar via Digitalmars-d
On Wed, 19 Nov 2014 13:44:09 + via Digitalmars-d digitalmars-d@puremagic.com wrote: Ah, right, it _does_ work with explicitly defined constructors. Maybe GValue doesn't have those? that may be true. i'm too lazy to look at the sources, and it seems to me that it's very easy to miss the

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread ketmar via Digitalmars-d
On Wed, 19 Nov 2014 13:47:50 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: yes. besides, there is no such thing as negative length, so it's somewhat... weird to use signed integer for length. A length can certainly be negative. Just as a bank balance can be negative.

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread FrankLike via Digitalmars-d
If I have two pencils of length 10 cm and 15 cm, then the first one is -5 cm longer than the other. Of course any physical pencil is always of positive length, but that doesn't mean that typeof(pencil.length) can never be negative. Right. 'int' is easy to use,is enough,and easy to migrate

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Don via Digitalmars-d
On Wednesday, 19 November 2014 at 13:47:31 UTC, ketmar via Digitalmars-d wrote: On Wed, 19 Nov 2014 13:33:21 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: No. Signed types do not *wrap*. They *overflow* if their range is exceeded. same for unsigned ints. This is not the

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread ketmar via Digitalmars-d
On Wed, 19 Nov 2014 14:04:15 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: I don't know what you mean. For unsigned ints, carry is not an error. That's the whole point of unsigned! this *may* be not a error. it depends of what programmer wants. This is the job of the

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Matthias Bentrup via Digitalmars-d
On Wednesday, 19 November 2014 at 14:04:16 UTC, Don wrote: No. The point is to get correct semantics. Unsigned types do not have the correct semantics. Signed types do. In D both signed and unsigned integers have defined wrapping semantincs. In C++ signed integers are allowed to format your

Re: Documentation of DList in std.container seems to be inaccurate

2014-11-19 Thread H. S. Teoh via Digitalmars-d
On Wed, Nov 19, 2014 at 08:18:55AM +, Koz Ross via Digitalmars-d wrote: I just spent a good while debugging something which arose as a result of the documentation of the DList's removeAny function. More precisely, it seems that removeAny removes from the *back*, rather than the front, as

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread David Gileadi via Digitalmars-d
On 11/19/14, 6:57 AM, ketmar via Digitalmars-d wrote: On Wed, 19 Nov 2014 13:47:50 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: If I have two pencils of length 10 cm and 15 cm, then the first one is -5 cm longer than the other. and again length is not a relation. show me

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread bearophile via Digitalmars-d
David Gileadi: writefln(%s, b.length - a.length); // Yup, 2 writefln(%s, a.length - b.length); // WAT? 18446744073709551614 Nowadays a better way to write such kind of code is using the Phobos signed function: writefln(%s, b.length.signed - a.length.signed); writefln(%s,

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread ketmar via Digitalmars-d
On Wed, 19 Nov 2014 09:02:49 -0700 David Gileadi via Digitalmars-d digitalmars-d@puremagic.com wrote: On 11/19/14, 6:57 AM, ketmar via Digitalmars-d wrote: On Wed, 19 Nov 2014 13:47:50 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: If I have two pencils of length 10 cm and

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread David Gileadi via Digitalmars-d
On 11/19/14, 9:12 AM, bearophile wrote: David Gileadi: writefln(%s, b.length - a.length); // Yup, 2 writefln(%s, a.length - b.length); // WAT? 18446744073709551614 Nowadays a better way to write such kind of code is using the Phobos signed function: writefln(%s, b.length.signed -

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread bearophile via Digitalmars-d
David Gileadi: But this requires the following knowledge: 1. That the signed function exists, and its location. As a casual D programmer I didn't know about it. 2. That there's a need for it at all, which requires knowing that length is unsigned. I did know this, but I bet in the heat of

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Andrei Alexandrescu via Digitalmars-d
On 11/19/14 2:03 AM, Don wrote: On Tuesday, 18 November 2014 at 18:23:52 UTC, Marco Leise wrote: Am Tue, 18 Nov 2014 15:01:25 + schrieb Frank Like 1150015...@qq.com: but now ,'int' is enough for use,not huge and not small,only enough. 'int' is easy to write,and most people are used to

Rust lifetimes and collections [OT]

2014-11-19 Thread bearophile via Digitalmars-d
It shows the tradeoffs of static enforcement of memory safety in Rust: http://cglab.ca/~abeinges/blah/rust-lifetimes-and-collections/ Some quotations: However it's fairly easy to make an incorrect program by overflowing an integer. Some would therefore assert that it should be unsafe to add

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread bearophile via Digitalmars-d
ketmar: ah, let range checking catch that. No thanks, I prefer to not have bugs in the first place. besides, overflows are possible with signed ints too, From my experience in coding in D they are far more unlikely than sign-related bugs of array lengths. so what signed length does

[OT] suggestions for a programmable drone on a budget?

2014-11-19 Thread Adam D. Ruppe via Digitalmars-d
I've been kinda wanting to build some kind of programmable aircraft ever since watching DConf this year and now I'm thinking about actually doing it. What I'm envisioning is something like a quadcopter that we can program to follow a pre-set course. Or something. A fun demo might be to set

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Andrei Alexandrescu via Digitalmars-d
On 11/19/14 6:04 AM, Don wrote: Almost everybody seems to think that unsigned means positive. It does not. That's an exaggeration. With only a bit of care one can use D's unsigned types for positive numbers. Please let's not reduce the matter to black and white. Andrei

Re: Rust lifetimes and collections [OT]

2014-11-19 Thread Andrei Alexandrescu via Digitalmars-d
On 11/19/14 8:54 AM, bearophile wrote: This is nice: fn split_at_mut(mut self, mid: uint) - (mut [T], mut [T]); Bye, bearophile Why did this redditor say it's a horrific hack? http://www.reddit.com/r/programming/comments/2mqyd3/rust_lifetimes_and_collections/cm6yj7b Andrei

Re: New std.range submodule

2014-11-19 Thread Nick Treleaven via Digitalmars-d
On 14/11/2014 21:52, David Nadlinger wrote: On Friday, 14 November 2014 at 06:10:43 UTC, Rikki Cattermole wrote: std.range.checks For this, std.range.constraints would also be perfectly fine. If it's not too late, can we change the name to std.range.traits? It seems better as they can be

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Ary Borenszweig via Digitalmars-d
On 11/19/14, 7:03 AM, Don wrote: On Tuesday, 18 November 2014 at 18:23:52 UTC, Marco Leise wrote: Weird consequence: using subtraction with an unsigned type is nearly always a bug. I wish D hadn't called unsigned integers 'uint'. They should have been called '__uint' or something. They

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Ary Borenszweig via Digitalmars-d
On 11/19/14, 1:46 PM, Andrei Alexandrescu wrote: On 11/19/14 2:03 AM, Don wrote: We have a builtin type that is deadly but seductive. I agree this applies to C and C++. Not quite to D. -- Andrei See my response to Don. Don't you think that's counter-intuitive?

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Ary Borenszweig via Digitalmars-d
On 11/19/14, 10:21 AM, ketmar via Digitalmars-d wrote: On Wed, 19 Nov 2014 10:03:34 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: No! No! No! This is completely wrong. Unsigned does not mean positive. It means no sign, and therefore wrapping semantics. eg length - 4 0, if

Re: New std.range submodule

2014-11-19 Thread H. S. Teoh via Digitalmars-d
On Wed, Nov 19, 2014 at 06:06:26PM +, Nick Treleaven via Digitalmars-d wrote: On 14/11/2014 21:52, David Nadlinger wrote: On Friday, 14 November 2014 at 06:10:43 UTC, Rikki Cattermole wrote: std.range.checks For this, std.range.constraints would also be perfectly fine. If it's not

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread via Digitalmars-d
On Wednesday, 19 November 2014 at 16:02:50 UTC, David Gileadi wrote: On 11/19/14, 6:57 AM, ketmar via Digitalmars-d wrote: On Wed, 19 Nov 2014 13:47:50 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: If I have two pencils of length 10 cm and 15 cm, then the first one is -5 cm

Re: Rust lifetimes and collections [OT]

2014-11-19 Thread deadalnix via Digitalmars-d
On Wednesday, 19 November 2014 at 17:58:01 UTC, Andrei Alexandrescu wrote: On 11/19/14 8:54 AM, bearophile wrote: This is nice: fn split_at_mut(mut self, mid: uint) - (mut [T], mut [T]); Bye, bearophile Why did this redditor say it's a horrific hack?

Re: Rust lifetimes and collections [OT]

2014-11-19 Thread Vladimir Panteleev via Digitalmars-d
On Wednesday, 19 November 2014 at 17:58:01 UTC, Andrei Alexandrescu wrote: On 11/19/14 8:54 AM, bearophile wrote: This is nice: fn split_at_mut(mut self, mid: uint) - (mut [T], mut [T]); Bye, bearophile Why did this redditor say it's a horrific hack?

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Andrei Alexandrescu via Digitalmars-d
On 11/19/14 10:09 AM, Ary Borenszweig wrote: On 11/19/14, 7:03 AM, Don wrote: On Tuesday, 18 November 2014 at 18:23:52 UTC, Marco Leise wrote: Weird consequence: using subtraction with an unsigned type is nearly always a bug. I wish D hadn't called unsigned integers 'uint'. They should

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Andrei Alexandrescu via Digitalmars-d
On 11/19/14 10:13 AM, Ary Borenszweig wrote: On 11/19/14, 1:46 PM, Andrei Alexandrescu wrote: On 11/19/14 2:03 AM, Don wrote: We have a builtin type that is deadly but seductive. I agree this applies to C and C++. Not quite to D. -- Andrei See my response to Don. Don't you think that's

Re: Invariant for default construction

2014-11-19 Thread Steven Schveighoffer via Digitalmars-d
On 11/19/14 3:46 AM, Daniel Murphy wrote: Rainer Schuetze wrote in message news:m4eu6v$trq$1...@digitalmars.com... I remember having an invariant on a tree structure checking consistency by verifying the children and parent references. This crashed when adding a destructor. With the proposed

Re: [OT] suggestions for a programmable drone on a budget?

2014-11-19 Thread Dmitry Olshansky via Digitalmars-d
19-Nov-2014 20:42, Adam D. Ruppe пишет: I've been kinda wanting to build some kind of programmable aircraft ever since watching DConf this year and now I'm thinking about actually doing it. What I'm envisioning is something like a quadcopter that we can program to follow a pre-set course. Or

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: No. -- Andrei Yet, experience in D has shown very well that having unsigned lengths is the wrong design choice. It's a D wart. Bye, bearophile

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: There are related bugs in Java too, e.g. I remember one in binary search where (i + j) / 2 was wrong because of an overflow. This is possible in D too. Also, Java does have a package for unsigned integers so apparently it's necessary. This is irrelevant. No one here

Re: Rust lifetimes and collections [OT]

2014-11-19 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: Why did this redditor say it's a horrific hack? http://www.reddit.com/r/programming/comments/2mqyd3/rust_lifetimes_and_collections/cm6yj7b For me it's a nice construct, it's something unsafe that the compiler has to assume for correct. In a language, unless you want a

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Matthias Bentrup via Digitalmars-d
On Wednesday, 19 November 2014 at 20:40:53 UTC, bearophile wrote: Andrei Alexandrescu: There are related bugs in Java too, e.g. I remember one in binary search where (i + j) / 2 was wrong because of an overflow. This is possible in D too. Also, Java does have a package for unsigned

Re: GTKD2 GValue Type

2014-11-19 Thread Mike Wey via Digitalmars-d
On 11/19/2014 03:50 AM, Sergey wrote: Hello everyone! I try to use gtkd + d in production, and of course I started with gtk.TreeView and gtk.ListStore objects. But I encounter a problem with GValyue type: GValue[] array_values = cast(GValue[])[str1,str2,str3,str4]; file_1.d(92): Error:

Re: Program logic bugs vs input/environmental errors

2014-11-19 Thread Walter Bright via Digitalmars-d
On 11/19/2014 3:59 AM, Bruno Medeiros wrote: Just to add another one, one that I recently came across while coding, was an assertion check that I put, which, if it where to fail, would only cause a redundant use of memory (but no NPEs or access violations or invalid state, etc.). If you're

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread uri via Digitalmars-d
On Wednesday, 19 November 2014 at 18:09:11 UTC, Ary Borenszweig wrote: On 11/19/14, 7:03 AM, Don wrote: On Tuesday, 18 November 2014 at 18:23:52 UTC, Marco Leise wrote: Weird consequence: using subtraction with an unsigned type is nearly always a bug. I wish D hadn't called unsigned

Re: Would you trade 0.1% in performance for a better debugging experience?

2014-11-19 Thread Rainer Schuetze via Digitalmars-d
On 18.11.2014 00:14, Vladimir Panteleev wrote: I proposed to build Phobos and Druntime with stack frames enabled: [...] Personally, I think the 0.1% is practically negligible considering the advantages. My proposal was rejected, so I'd like to hear more opinions about this. What do you

Re: Documentation of DList in std.container seems to be inaccurate

2014-11-19 Thread Meta via Digitalmars-d
On Wednesday, 19 November 2014 at 15:45:34 UTC, H. S. Teoh via Digitalmars-d wrote: The documentation was wrong before, but the whole point of removeAny() is that it removes *any* element from the container, and it's not specified *which* one is removed. The fact that a particular element

Re: Invariant for default construction

2014-11-19 Thread Rainer Schuetze via Digitalmars-d
On 19.11.2014 21:08, Steven Schveighoffer wrote: On 11/19/14 3:46 AM, Daniel Murphy wrote: Rainer Schuetze wrote in message news:m4eu6v$trq$1...@digitalmars.com... I remember having an invariant on a tree structure checking consistency by verifying the children and parent references. This

Re: [OT] suggestions for a programmable drone on a budget?

2014-11-19 Thread Mike via Digitalmars-d
On Wednesday, 19 November 2014 at 17:42:16 UTC, Adam D. Ruppe wrote: You've marked this OT so I'm assuming you're not motivated to do this in D. If I'm wrong, then it's very much on topic, IMO. A ground robot would be nice too, heck that's the kind of thing I might be able to build

Re: [OT] suggestions for a programmable drone on a budget?

2014-11-19 Thread Adam D. Ruppe via Digitalmars-d
On Wednesday, 19 November 2014 at 23:12:31 UTC, Mike wrote: You've marked this OT so I'm assuming you're not motivated to do this in D. If I'm wrong, then it's very much on topic, IMO. I probably would use D, but might not due to some external factors. Part of my motivation is doing it in

Re: [OT] suggestions for a programmable drone on a budget?

2014-11-19 Thread Adam D. Ruppe via Digitalmars-d
On Wednesday, 19 November 2014 at 20:26:01 UTC, Dmitry Olshansky wrote: Yeah, be prepared to find good big chamber for it. 3 meters tall at least. No ropes or other stuff dangling around! Also catching the thing may prove real hard, so soft floors would be awesome. Hmm, yeah, perhaps we can

Re: [OT] suggestions for a programmable drone on a budget?

2014-11-19 Thread Mike via Digitalmars-d
On Wednesday, 19 November 2014 at 23:31:12 UTC, Adam D. Ruppe wrote: But then again, you aren't going to be running a drone on Javascript and Scratch anyway!) According to this, Javascript looks feasible: http://www.espruino.com/ Mike

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Andrei Alexandrescu via Digitalmars-d
On 11/19/14 12:38 PM, bearophile wrote: Andrei Alexandrescu: No. -- Andrei Yet, experience in D has shown very well that having unsigned lengths is the wrong design choice. It's a D wart. Care to back that up? -- Andrei

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Andrei Alexandrescu via Digitalmars-d
On 11/19/14 12:40 PM, bearophile wrote: Andrei Alexandrescu: There are related bugs in Java too, e.g. I remember one in binary search where (i + j) / 2 was wrong because of an overflow. This is possible in D too. Also, Java does have a package for unsigned integers so apparently it's

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread H. S. Teoh via Digitalmars-d
On Wed, Nov 19, 2014 at 04:08:11PM -0800, Andrei Alexandrescu via Digitalmars-d wrote: On 11/19/14 12:40 PM, bearophile wrote: Andrei Alexandrescu: There are related bugs in Java too, e.g. I remember one in binary search where (i + j) / 2 was wrong because of an overflow. This is

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Andrei Alexandrescu via Digitalmars-d
On 11/19/14 4:24 PM, H. S. Teoh via Digitalmars-d wrote: On Wed, Nov 19, 2014 at 04:08:11PM -0800, Andrei Alexandrescu via Digitalmars-d wrote: On 11/19/14 12:40 PM, bearophile wrote: Andrei Alexandrescu: There are related bugs in Java too, e.g. I remember one in binary search where (i + j)

Re: [OT] suggestions for a programmable drone on a budget?

2014-11-19 Thread Adam D. Ruppe via Digitalmars-d
On Thursday, 20 November 2014 at 00:08:25 UTC, Mike wrote: According to this, Javascript looks feasible: http://www.espruino.com/ wow, apparently scratch might be too! http://s4a.cat/ That's remarkable.

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread FrankLike via Digitalmars-d
How is that a bug? Can you provide some code that exhibits this? If you compile the dfl Library to 64 bit,you will find error: core.sys.windows.windows.WaitForMultipleObjects(uint nCount,void** lpHandles,) is not callable using argument types(ulong,void**,...) the 'WaitForMultipleObjects'

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread H. S. Teoh via Digitalmars-d
On Wed, Nov 19, 2014 at 04:42:53PM -0800, Andrei Alexandrescu via Digitalmars-d wrote: On 11/19/14 4:24 PM, H. S. Teoh via Digitalmars-d wrote: On Wed, Nov 19, 2014 at 04:08:11PM -0800, Andrei Alexandrescu via Digitalmars-d wrote: On 11/19/14 12:40 PM, bearophile wrote: Andrei Alexandrescu:

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread flamencofantasy via Digitalmars-d
On Wednesday, 19 November 2014 at 20:38:15 UTC, bearophile wrote: Andrei Alexandrescu: No. -- Andrei Yet, experience in D has shown very well that having unsigned lengths is the wrong design choice. It's a D wart. Bye, bearophile Yet, MY experience in D has shown very well that having

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread deadalnix via Digitalmars-d
On Thursday, 20 November 2014 at 00:07:23 UTC, Andrei Alexandrescu wrote: On 11/19/14 12:38 PM, bearophile wrote: Andrei Alexandrescu: No. -- Andrei Yet, experience in D has shown very well that having unsigned lengths is the wrong design choice. It's a D wart. Care to back that up? --

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread H. S. Teoh via Digitalmars-d
On Thu, Nov 20, 2014 at 01:00:00AM +, flamencofantasy via Digitalmars-d wrote: On Wednesday, 19 November 2014 at 20:38:15 UTC, bearophile wrote: [...] Yet, experience in D has shown very well that having unsigned lengths is the wrong design choice. It's a D wart. Bye, bearophile

Re: [OT] suggestions for a programmable drone on a budget?

2014-11-19 Thread Mike via Digitalmars-d
On Thursday, 20 November 2014 at 00:47:58 UTC, Adam D. Ruppe wrote: On Thursday, 20 November 2014 at 00:08:25 UTC, Mike wrote: According to this, Javascript looks feasible: http://www.espruino.com/ wow, apparently scratch might be too! http://s4a.cat/ Sigh! I'm so ashamed. Even the toy

Re: GTKD2 GValue Type

2014-11-19 Thread Sergey via Digitalmars-d
Ok, thanks. I'll just use this command: ListStore1.setValue(itr, 0, some str); ...

Re: GTKD2 GValue Type

2014-11-19 Thread Sergey via Digitalmars-d
auto ggg = GValue(123); file_12.d(27): Error: cannot implicitly convert expression (123) of type string to GType GValue ggg = {ki,}; file_12.d(22): Error: cannot implicitly convert expression (ki) of type string to GType

Re: [OT] suggestions for a programmable drone on a budget?

2014-11-19 Thread Rikki Cattermole via Digitalmars-d
On 20/11/2014 1:08 p.m., Mike wrote: On Wednesday, 19 November 2014 at 23:31:12 UTC, Adam D. Ruppe wrote: But then again, you aren't going to be running a drone on Javascript and Scratch anyway!) According to this, Javascript looks feasible: http://www.espruino.com/ Mike

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread Ary Borenszweig via Digitalmars-d
On 11/19/14, 9:54 PM, FrankLike wrote: How is that a bug? Can you provide some code that exhibits this? If you compile the dfl Library to 64 bit,you will find error: core.sys.windows.windows.WaitForMultipleObjects(uint nCount,void** lpHandles,) is not callable using argument

Re: 'int' is enough for 'length' to migrate code from x86 to x64

2014-11-19 Thread FrankLike via Digitalmars-d
That I partially, fractionally even, agree with. We agonized for a long time about what to do to improve on the state of the art back in 2007 - literally months I recall. Part of the conclusion was that reverting to int for object lengths would be a net negative. Andrei All of these

Re: Invariant for default construction

2014-11-19 Thread Jacob Carlborg via Digitalmars-d
On 2014-11-19 21:08, Steven Schveighoffer wrote: We really *REALLY* need a mechanism to determine whether destruction is happening in a GC or not. In synchronous destruction (i.e. destroy or scoped), you can run the invariant. In GC, you cannot. Tango for D1 had that. A new method, dispose,

Re: Explicitly Freeing Memory

2014-11-19 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
Unfortunately I don't have any good suggestions... I have been avoiding depending on dtors in D because of the aforementioned issues (and more), so I haven't had much experience in debugging dtor-related problems in D. I decided to just free everything explicitly:

  1   2   >