Re: Silicon Valley D Meetup January 28, 2016

2016-01-29 Thread Ali Çehreli via Digitalmars-d-announce
On 01/28/2016 08:37 PM, Adam D. Ruppe wrote: > I've been listening in on this Why didn't you say hi? :) This has been the first time that we didn't have the attendance list open, so we didn't even know whether others were connected. Come to think of it, I think we were seeing just two

[Issue 15621] std.file.rename does not allow moving files to a different drive

2016-01-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15621 yebblies changed: What|Removed |Added Keywords||pull

Re: `alias this` pointers and typeof(null)

2016-01-29 Thread Andrea Fontana via Digitalmars-d
On Friday, 29 January 2016 at 13:38:20 UTC, Tomer Filiba wrote: I can change all such invocations into ``func(FooPtr(null))`` but it's tedious and basically requires me to compile tens of times before I'd cover everything. Is there some workaround to make null implicitly convertible to my

Re: Overriding opEquals in classes, for comparison with things that aren't Objects

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Friday, 29 January 2016 at 15:00:59 UTC, pineapple wrote: With this bit of code, the first method seems to work fine - things go as expected. But I get a compile error with the second method, and I'm not sure how else to write this. override bool opEquals(Object value) const{

Re: Why is it a memory ERRO.

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Friday, 29 January 2016 at 13:22:07 UTC, Mike Parker wrote: Your problem is probably that you are calling GC.free in the destructor. Don't do this. You don't need to call GC.free at all. The GC will collect both your object instance and the memory you allocated with new. Never, ever,

`alias this` pointers and typeof(null)

2016-01-29 Thread Tomer Filiba via Digitalmars-d
I had a struct (Foo) that was passed by pointer (i.e., Foo*) throughout my code. To prevent dangling pointers, I created a `FooPtr` struct with an `alias this` that does some checks before returning me the underlying pointer. This is sort-of what I have: struct FooPtr { Foo* ptr;

Re: Movable resource handles

2016-01-29 Thread Matt Elkins via Digitalmars-d
On Thursday, 28 January 2016 at 06:13:32 UTC, Era Scarecrow wrote: On Thursday, 28 January 2016 at 05:39:55 UTC, Era Scarecrow wrote: It really comes down to that an array qualifies as an Lvalue operator; But I _think_ this is a bug in the language since you should be able to assign a new

Re: reduce -> fold?

2016-01-29 Thread Luís Marques via Digitalmars-d
On Friday, 29 January 2016 at 13:56:48 UTC, Dragos Carp wrote: But not in python, where "accumulate"[1] is the generic equivalent of C++ "partial_sum"[2]. I like "fold" more. BTW this week, a colleague of mine implemented a python "accumulate" in D. Is there any interest to contribute it to

Re: reduce -> fold?

2016-01-29 Thread Dragos Carp via Digitalmars-d
On Friday, 29 January 2016 at 13:11:34 UTC, Luís Marques wrote: Just to bikeshed a little, I remember that when I first started using std.algorithm I was ctrl-F'ing for "accumulate" and not finding it quite often. D competes with C++ directly, so do consider that name :-) But not in python,

Overriding opEquals in classes, for comparison with things that aren't Objects

2016-01-29 Thread pineapple via Digitalmars-d-learn
With this bit of code, the first method seems to work fine - things go as expected. But I get a compile error with the second method, and I'm not sure how else to write this. override bool opEquals(Object value) const{ return this.equals(cast(typeof(this)) value); }

Re: Overriding opEquals in classes, for comparison with things that aren't Objects

2016-01-29 Thread pineapple via Digitalmars-d-learn
It also occurred to me to do something like this, but it isn't accepted either. override bool opEquals(T)(T value){ return this.equals(value); }

Re: Why is it a memory ERRO.

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Friday, 29 January 2016 at 12:43:53 UTC, Dsby wrote: the Code: ~this(){ GC.free(by.ptr); by = null; writeln("free"); } Your problem is probably that you are calling GC.free in the destructor. Don't do this. You don't need

Re: `alias this` pointers and typeof(null)

2016-01-29 Thread Tomer Filiba via Digitalmars-d
On Friday, 29 January 2016 at 13:59:15 UTC, Andrea Fontana wrote: What about this: http://dpaste.dzfl.pl/3305cdf8b7b4 ? Andrea Thanks Andrea, I thought about it but it requires duplicating all function signatures (and not in an automatic manner). Btw, you can also write ``void

Re: D vs Rust

2016-01-29 Thread Ola Fosheim Grøstad via Digitalmars-d
On Friday, 29 January 2016 at 07:01:07 UTC, Sönke Ludwig wrote: Am 29.01.2016 um 00:18 schrieb Ola Foaheim Grøstad: D is closer to C++ style templating and OO, and currently focus on enabling binding to non-template C++ libraries. Small correction: Should be "binding to template based C++

Re: D vs Rust

2016-01-29 Thread qznc via Digitalmars-d
On Thursday, 28 January 2016 at 22:30:51 UTC, nbro wrote: Apart from [syntax], what are the real advantages of D over Rust? D is a broader language and is applicable in more situations. In many cases you don't care and don't want to care about memory management. Use D and its garbage

Re: What are the real GUI toolkits for D?

2016-01-29 Thread interessted via Digitalmars-d
On Friday, 29 January 2016 at 10:18:31 UTC, interessted wrote: On Thursday, 28 January 2016 at 16:57:04 UTC, thedeemon wrote: On Sunday, 24 January 2016 at 12:16:09 UTC, nbro wrote: Except for GtkD and DWT, D does not seem to be supported by a really nice GUI toolkit. For Windows DFL is

Re: C++17

2016-01-29 Thread Ola Fosheim Grøstad via Digitalmars-d
https://www.reddit.com/r/cpp/comments/41uflq/bjarne_stroustrup_doing_an_ama/ Mentions D.

Re: reduce -> fold?

2016-01-29 Thread Adrian Matoga via Digitalmars-d
On Friday, 29 January 2016 at 12:08:01 UTC, Andrei Alexandrescu wrote: As has been discussed before there's been discussion about std.algorithm.reduce taking the "wrong" order of arguments (its definition predates UFCS). I recall the conclusion was there'd be subtle ambiguities if we worked

Re: reduce -> fold?

2016-01-29 Thread Luís Marques via Digitalmars-d
On Friday, 29 January 2016 at 12:08:01 UTC, Andrei Alexandrescu wrote: So the next best solution is to introduce a new name such as the popular "fold", and put them together in the documentation. Just to bikeshed a little, I remember that when I first started using std.algorithm I was

Re: What are the real advantages that D offers in multithreading?

2016-01-29 Thread Thiez via Digitalmars-d
On Thursday, 28 January 2016 at 22:59:58 UTC, cym13 wrote: On Thursday, 28 January 2016 at 11:53:48 UTC, Russel Winder wrote: It should be pointed out that anyone using the synchronized keyword anywhere in Java code is doing concurrent and parallel programming wrong. If they are using

reduce -> fold?

2016-01-29 Thread Andrei Alexandrescu via Digitalmars-d
As has been discussed before there's been discussion about std.algorithm.reduce taking the "wrong" order of arguments (its definition predates UFCS). I recall the conclusion was there'd be subtle ambiguities if we worked reduce to implement both orders. So the next best solution is to

Re: D vs Rust

2016-01-29 Thread Kagamin via Digitalmars-d
On Friday, 29 January 2016 at 07:01:07 UTC, Sönke Ludwig wrote: Small correction: Should be "binding to template based C++ libraries" - non-template libraries have worked more or less for a while now. Actually less. Without RAII you can't bind any realistic C++ library like Qt.

[Issue 15619] [REG 2.068] Floating-point x86_64 codegen regression, when involving array ops

2016-01-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15619 ponce changed: What|Removed |Added Summary|[REG 2.068] Floating-point |[REG 2.068] Floating-point

Re: What are the real GUI toolkits for D?

2016-01-29 Thread interessted via Digitalmars-d
On Friday, 29 January 2016 at 11:30:41 UTC, Suliman wrote: On Friday, 29 January 2016 at 10:41:03 UTC, interessted wrote: On Friday, 29 January 2016 at 10:18:31 UTC, interessted wrote: On Thursday, 28 January 2016 at 16:57:04 UTC, thedeemon wrote: On Sunday, 24 January 2016 at 12:16:09 UTC,

Re: C++17

2016-01-29 Thread Ola Fosheim Grøstad via Digitalmars-d
On Friday, 29 January 2016 at 10:43:08 UTC, Ola Fosheim Grøstad wrote: https://www.reddit.com/r/cpp/comments/41uflq/bjarne_stroustrup_doing_an_ama/ Mentions D. Since it is in danish, let me quickly translate the informative sections: Bjarne Stroustrup (translated from danish): The safety

math libraries

2016-01-29 Thread interessted via Digitalmars-d
are you handling this in the math libs? http://milesmathis.com/pi2.html http://milesmathis.com/pi4.html

Re: What are the real GUI toolkits for D?

2016-01-29 Thread interessted via Digitalmars-d
On Friday, 29 January 2016 at 12:12:40 UTC, interessted wrote: On Friday, 29 January 2016 at 11:30:41 UTC, Suliman wrote: On Friday, 29 January 2016 at 10:41:03 UTC, interessted wrote: On Friday, 29 January 2016 at 10:18:31 UTC, interessted wrote: On Thursday, 28 January 2016 at 16:57:04 UTC,

[Issue 15622] New: Order of execution of module destructors is not always correct

2016-01-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15622 Issue ID: 15622 Summary: Order of execution of module destructors is not always correct Product: D Version: D2 Hardware: All OS: Linux Status: NEW

d plugin for Intelij Idea debuging support

2016-01-29 Thread Pavel via Digitalmars-d-learn
Hello! Is there any debuging support for Intelij Idea's D plugin? Thanks!

Why is it a memory ERRO.

2016-01-29 Thread Dsby via Digitalmars-d-learn
the Code: class MyClass { this(){ by = new ubyte[1]; ++i; } ~this(){ GC.free(by.ptr); by = null; writeln("free"); } void show(){ writeln(i); };

Re: What are the real GUI toolkits for D?

2016-01-29 Thread Luis via Digitalmars-d
On Thursday, 28 January 2016 at 16:57:04 UTC, thedeemon wrote: On Sunday, 24 January 2016 at 12:16:09 UTC, nbro wrote: Except for GtkD and DWT, D does not seem to be supported by a really nice GUI toolkit. For Windows DFL is quite nice and working well (I've used it in several projects).

Re: What are the real GUI toolkits for D?

2016-01-29 Thread Suliman via Digitalmars-d
On Friday, 29 January 2016 at 10:41:03 UTC, interessted wrote: On Friday, 29 January 2016 at 10:18:31 UTC, interessted wrote: On Thursday, 28 January 2016 at 16:57:04 UTC, thedeemon wrote: On Sunday, 24 January 2016 at 12:16:09 UTC, nbro wrote: Except for GtkD and DWT, D does not seem to be

Re: Why is it a memory ERRO.

2016-01-29 Thread Dsby via Digitalmars-d-learn
On Friday, 29 January 2016 at 12:43:53 UTC, Dsby wrote: the Code: class MyClass { this(){ by = new ubyte[1]; ++i; } ~this(){ GC.free(by.ptr); by = null; writeln("free"); }

Re: What are the real GUI toolkits for D?

2016-01-29 Thread MGW via Digitalmars-d
I think what to make "pure" GUI for D there is a waste of time and forces. More effectively and faster to develop "wrapper" for Qt. For myself I have made library QtE which possibilities suffice me much. The main feature that addition of a new method or property from Qt in QtE occupies

Re: merging map/filter/reduce/... in D

2016-01-29 Thread glathoud via Digitalmars-d-learn
Thanks. I am glad be wrong on that one. I had a look at map & filter in the source code ; pleased to see they're lazily implemented! map https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm/iteration.d#L425 filter

Re: D vs Rust

2016-01-29 Thread Ola Fosheim Grøstad via Digitalmars-d
On Friday, 29 January 2016 at 08:26:01 UTC, John Colvin wrote: It depends what you mean by templated. I believe the interoperability work is for the results of instantiated templates, not on the templates themselves. Hmm, not sure how important that is. At least in my C++ class templates

Re: What are the real GUI toolkits for D?

2016-01-29 Thread interessted via Digitalmars-d
On Thursday, 28 January 2016 at 16:57:04 UTC, thedeemon wrote: On Sunday, 24 January 2016 at 12:16:09 UTC, nbro wrote: Except for GtkD and DWT, D does not seem to be supported by a really nice GUI toolkit. For Windows DFL is quite nice and working well (I've used it in several projects).

[Issue 15621] New: std.file.rename does not allow moving files to a different drive

2016-01-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15621 Issue ID: 15621 Summary: std.file.rename does not allow moving files to a different drive Product: D Version: D2 Hardware: All OS: Windows Status:

Re: D vs Rust

2016-01-29 Thread John Colvin via Digitalmars-d
On Friday, 29 January 2016 at 08:23:38 UTC, Ola Fosheim Grøstad wrote: On Friday, 29 January 2016 at 07:01:07 UTC, Sönke Ludwig wrote: Am 29.01.2016 um 00:18 schrieb Ola Foaheim Grøstad: D is closer to C++ style templating and OO, and currently focus on enabling binding to non-template C++

Re: merging map/filter/reduce/... in D

2016-01-29 Thread cym13 via Digitalmars-d-learn
On Friday, 29 January 2016 at 08:06:14 UTC, glathoud wrote: Thanks. I am glad be wrong on that one. I had a look at map & filter in the source code ; pleased to see they're lazily implemented! map https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm/iteration.d#L425

Re: Overriding opEquals in classes, for comparison with things that aren't Objects

2016-01-29 Thread pineapple via Digitalmars-d-learn
On Friday, 29 January 2016 at 15:13:45 UTC, Mike Parker wrote: The first implementation is fine because you're overriding the implementation in the base class (Object). However, the second one fails because it's a template. Templates are non-virtual and cannot override anything. Even if you

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 January 2016 at 15:28:29 UTC, Adrian Matoga wrote: How can I reliably test if CallsFoo can be instantiated? You can use a constraint to prevent invalid instantiation: struct HasFoo { void foo() {} } struct NoFoo {} struct CallsFoo(T) if (__traits(hasMember, T, "foo")) {

Re: Vision for the first semester of 2016

2016-01-29 Thread Adam D. Ruppe via Digitalmars-d-announce
On Thursday, 28 January 2016 at 12:40:56 UTC, Ola Fosheim Grøstad wrote: I think that Sonke received too much "negative motivation" for his contributions recently, if I had been in his shoes I'd probably found working on vibe.d more fun. IRRC Ruppe also have voiced that he want to work on

[Issue 15623] New: is(M!N) evaluates to true for M!N that fails to instantiate.

2016-01-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15623 Issue ID: 15623 Summary: is(M!N) evaluates to true for M!N that fails to instantiate. Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW

Re: `alias this` pointers and typeof(null)

2016-01-29 Thread Benjamin Thaut via Digitalmars-d
On Friday, 29 January 2016 at 13:38:20 UTC, Tomer Filiba wrote: I can change all such invocations into ``func(FooPtr(null))`` but it's tedious and basically requires me to compile tens of times before I'd cover everything. Is there some workaround to make null implicitly convertible to my

Re: What are the real GUI toolkits for D?

2016-01-29 Thread thedeemon via Digitalmars-d
On Friday, 29 January 2016 at 10:41:03 UTC, interessted wrote: where can one find a working DFL version - compilable with the last compiler? The last compiler is just 1 day old, don't expect all libs updated this soon. ;) Usually I took DFL here: https://github.com/Rayerd/dfl/ There are

Re: Assert failure on 2.070.0 without stack trace

2016-01-29 Thread Benjamin Thaut via Digitalmars-d-learn
On Thursday, 28 January 2016 at 18:33:19 UTC, Nordlöw wrote: Thanks, I'm aware of these tools. But it's easier to use the stacktrace...if I only get one. The function where the assert() is called is, in turn, called in hundreds of places. Which platform are you on? Are all your binaries

Re: D vs Rust

2016-01-29 Thread bearophile via Digitalmars-d
qznc: On Friday, 29 January 2016 at 09:00:52 UTC, qznc wrote: D is a broader language and is applicable in more situations. In many cases you don't care and don't want to care about memory management. Learning to manage memory in Rust takes lot of time and practice, it's a bit painful. I am

Re: reduce -> fold?

2016-01-29 Thread ixid via Digitalmars-d
On Friday, 29 January 2016 at 12:08:01 UTC, Andrei Alexandrescu wrote: As has been discussed before there's been discussion about std.algorithm.reduce taking the "wrong" order of arguments (its definition predates UFCS). I recall the conclusion was there'd be subtle ambiguities if we worked

Re: reduce -> fold?

2016-01-29 Thread Y via Digitalmars-d
On Friday, 29 January 2016 at 12:08:01 UTC, Andrei Alexandrescu wrote: As has been discussed before there's been discussion about std.algorithm.reduce taking the "wrong" order of arguments (its definition predates UFCS). I recall the conclusion was there'd be subtle ambiguities if we worked

Re: reduce -> fold?

2016-01-29 Thread wobbles via Digitalmars-d
On Friday, 29 January 2016 at 12:08:01 UTC, Andrei Alexandrescu wrote: As has been discussed before there's been discussion about std.algorithm.reduce taking the "wrong" order of arguments (its definition predates UFCS). I recall the conclusion was there'd be subtle ambiguities if we worked

Re: reduce -> fold?

2016-01-29 Thread Brad Anderson via Digitalmars-d
On Friday, 29 January 2016 at 12:08:01 UTC, Andrei Alexandrescu wrote: As has been discussed before there's been discussion about std.algorithm.reduce taking the "wrong" order of arguments (its definition predates UFCS). I recall the conclusion was there'd be subtle ambiguities if we worked

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 10:28 AM, Adrian Matoga wrote: Code: struct HasFoo { void foo() {} } struct NoFoo {} struct CallsFoo(T) { T t; void bar() { t.foo(); } } static assert(is(CallsFoo!HasFoo)); alias Bar = CallsFoo!HasFoo; static assert(is(CallsFoo!NoFoo)); // (1) //alias Baz =

is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Adrian Matoga via Digitalmars-d-learn
Code: struct HasFoo { void foo() {} } struct NoFoo {} struct CallsFoo(T) { T t; void bar() { t.foo(); } } static assert(is(CallsFoo!HasFoo)); alias Bar = CallsFoo!HasFoo; static assert(is(CallsFoo!NoFoo)); // (1) //alias Baz = CallsFoo!NoFoo; // (2) This

InSituRegion + allocatorObject compile time error

2016-01-29 Thread ref2401 via Digitalmars-d-learn
Getting this error, could someone explain why? void main(string[] args) { InSituRegion!(1024) stackAlloc; IAllocator alloc = allocatorObject(stackAlloc); } ..\src\phobos\std\conv.d(5055): Error: static assert "Don't know how to initialize an object of type

RC vibe.d 0.7.27-rc.2

2016-01-29 Thread Sönke Ludwig via Digitalmars-d-announce
Am 22.01.2016 um 12:14 schrieb Sönke Ludwig: I've finally managed to tag a first beta for vibe.d. It contains numerous optimizations in the network and HTTP code, so it's especially important to thoroughly test this before release. 0.7.26 (except for the win32 driver) still compiles fine on DMD

Re: reduce -> fold?

2016-01-29 Thread Edwin van Leeuwen via Digitalmars-d
On Friday, 29 January 2016 at 16:38:23 UTC, Brad Anderson wrote: And just for completeness, here is monarchdodra's valiant but ultimately unsuccessful pull request which attempted fix reduce: https://github.com/D-Programming-Language/phobos/pull/861#issuecomment-20760448 Interestingly, that

Re: Release D 2.070.0

2016-01-29 Thread Adam D. Ruppe via Digitalmars-d-announce
On Friday, 29 January 2016 at 17:49:58 UTC, Nick Sabalausky wrote: I don't recall: Does that parse the source for comments on its own or does it still use dmd's json (or html) output? Does it on its own. (Well, except the search results page, it still uses the json, but I'm fixing that soon

Re: Vision for the first semester of 2016

2016-01-29 Thread Tofu Ninja via Digitalmars-d-announce
On Monday, 25 January 2016 at 02:37:40 UTC, Andrei Alexandrescu wrote: Hot off the press! http://wiki.dlang.org/Vision/2016H1 -- Andrei Just out of curiosity, is getting the different compilers in sync still a priority? Right now we have dmd at 2.070, ldc at 2.068. and gdc at 2.066.

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Adrian Matoga via Digitalmars-d-learn
On Friday, 29 January 2016 at 16:36:01 UTC, Steven Schveighoffer wrote: On 1/29/16 10:28 AM, Adrian Matoga wrote: Code: struct HasFoo { void foo() {} } struct NoFoo {} struct CallsFoo(T) { T t; void bar() { t.foo(); } } static assert(is(CallsFoo!HasFoo)); alias Bar =

opApply @safety

2016-01-29 Thread Chris Wright via Digitalmars-d-learn
I want to create an opApply for a type. I've marked my code @safe, because everything I wrote was @safe. The body of opApply is @safe, but it calls a delegate that may or may not be @safe. How do I make it so I can iterate through this type safely and systemly? I want to support iteration

Re: D vs Rust

2016-01-29 Thread Ola Fosheim Grøstad via Digitalmars-d
On Friday, 29 January 2016 at 15:39:53 UTC, bearophile wrote: D is also more flexible (higher order templates, better CTFE, unrestricted UFCS, etc), and you can port Python or C code to D faster than to Rust. So I think Rust targets a smaller number of coding purposes compared to D. Which

Re: D vs Rust

2016-01-29 Thread jmh530 via Digitalmars-d
On Friday, 29 January 2016 at 12:05:08 UTC, Kagamin wrote: Actually less. Without RAII you can't bind any realistic C++ library like Qt. My understanding is that D has a lot of options for behavior similar to RAII, but it does not have the full capability. What would be the most important

Re: Vision for the first semester of 2016

2016-01-29 Thread Iain Buclaw via Digitalmars-d-announce
On 29 Jan 2016 6:55 pm, "Tofu Ninja via Digitalmars-d-announce" < digitalmars-d-announce@puremagic.com> wrote: > > On Monday, 25 January 2016 at 02:37:40 UTC, Andrei Alexandrescu wrote: >> >> Hot off the press! http://wiki.dlang.org/Vision/2016H1 -- Andrei > > > Just out of curiosity, is getting

Re: Release D 2.070.0

2016-01-29 Thread Nick Sabalausky via Digitalmars-d-announce
On 01/29/2016 11:09 AM, Adam D. Ruppe wrote: On Thursday, 28 January 2016 at 19:46:48 UTC, Nick Sabalausky wrote: Use dpldocs.info. We have good docs. That's orthogonal to this. It is just another example of why I feel it is necessary to take a different direction than dmd. I see. Good

DMD 2.070.0 - The package is of bad quality

2016-01-29 Thread Gary Willoughby via Digitalmars-d
I get the following downloading and installing the Ubuntu x86_64 deb file. The package is of bad quality The installation of a package which violates the quality standards isn't allowed. This could cause serious problems on your computer. Please contact the person or organisation who

Re: Vision for the first semester of 2016

2016-01-29 Thread Ola Fosheim Grøstad via Digitalmars-d-announce
On Friday, 29 January 2016 at 16:07:48 UTC, Adam D. Ruppe wrote: In my perfect world, quality third party apps - as determined just by usage stats or something - would be automatically downloadable and their documentation searchable as if it was standard. I've noticed that curated lists of

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 6:44 PM, Basile B. wrote: Haven't you seen my answer about constraint ? If you put a constraint on your function template then invalid instantiations are rejected. I mean... this language feature is not just ornamental... What do you think constraints are used for otherwise ^^ A

Re: D vs Rust

2016-01-29 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 29 January 2016 at 18:43:19 UTC, Walter Bright wrote: On 1/29/2016 7:39 AM, bearophile wrote: [...] Nice to see you back, bearophile! Having not been around here much myself recently, I didn't even realize he was away, but ... agree :-)

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 January 2016 at 17:01:46 UTC, Adrian Matoga wrote: On Friday, 29 January 2016 at 16:36:01 UTC, Steven Schveighoffer wrote: On 1/29/16 10:28 AM, Adrian Matoga wrote: [...] is(T) is supposed to be false if T is not a valid type. I would agree with you that the static assert

Re: UTF-16 endianess

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 6:03 PM, Marek Janukowicz wrote: On Fri, 29 Jan 2016 17:43:26 -0500, Steven Schveighoffer wrote: Is there anything I should know about UTF endianess? It's not any different from other endianness. In other words, a UTF16 code unit is expected to be in the endianness of the platform

Re: Relocatable objects and internal pointers

2016-01-29 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Jan 30, 2016 at 01:21:27AM +, Matt Elkins via Digitalmars-d-learn wrote: > On Saturday, 30 January 2016 at 01:18:33 UTC, Ali Çehreli wrote: > >Definitely so. Rvalues are moved around all the time. The following > >program has two rvalue moves without calling post-blits or >

Re: Relocatable objects and internal pointers

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
On Saturday, 30 January 2016 at 01:28:54 UTC, H. S. Teoh wrote: On Sat, Jan 30, 2016 at 01:21:27AM +, Matt Elkins via Digitalmars-d-learn wrote: On Saturday, 30 January 2016 at 01:18:33 UTC, Ali Çehreli wrote: >Definitely so. Rvalues are moved around all the time. The >following program

Re: Relocatable objects and internal pointers

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 8:07 PM, Matt Elkins wrote: [snip] on D and came across a section in TDPL which said internal pointers are verboten because objects must be relocatable. Does this mean my example is invalid (e.g., the invariant will not hold in all circumstances)? If it is invalid, does that mean

Re: reduce -> fold?

2016-01-29 Thread Vladimir Panteleev via Digitalmars-d
On Friday, 29 January 2016 at 13:11:34 UTC, Luís Marques wrote: On Friday, 29 January 2016 at 12:08:01 UTC, Andrei Alexandrescu wrote: So the next best solution is to introduce a new name such as the popular "fold", and put them together in the documentation. Just to bikeshed a little, I

UTF-16 endianess

2016-01-29 Thread Marek Janukowicz via Digitalmars-d-learn
I have trouble understanding how endianess works for UTF-16. For example UTF-16 code for 'ł' character is 0x0142. But this program shows otherwise: import std.stdio; public void main () { ubyte[] properOrder = [0x01, 0x42]; ubyte[] reverseOrder = [0x42, 0x01]; writefln(

Trouble complinig DMD 2.070 on windows

2016-01-29 Thread E.S. Quinn via Digitalmars-d
I'm trying to compile a 64-bit DMD.exe on windows (as my project has enough CTFE and Template work that it bumps up against the 4gb limit). with the pre-DDMD setup I was just able to load the thing up in visual studio 2013 and build, but I've been having some difficulty with 2.070's

Re: opApply @safety

2016-01-29 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 January 2016 at 17:44:34 UTC, Chris Wright wrote: I want to create an opApply for a type. I've marked my code @safe, because everything I wrote was @safe. The body of opApply is @safe, but it calls a delegate that may or may not be @safe. How do I make it so I can iterate

Re: UTF-16 endianess

2016-01-29 Thread Johannes Pfau via Digitalmars-d-learn
Am Fri, 29 Jan 2016 18:58:17 -0500 schrieb Steven Schveighoffer : > On 1/29/16 6:03 PM, Marek Janukowicz wrote: > > On Fri, 29 Jan 2016 17:43:26 -0500, Steven Schveighoffer wrote: > >>> Is there anything I should know about UTF endianess? > >> > >> It's not any different

[Issue 15623] is(M!N) evaluates to true for M!N that fails to instantiate.

2016-01-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15623 Ali Cehreli changed: What|Removed |Added CC||acehr...@yahoo.com ---

Re: Relocatable objects and internal pointers

2016-01-29 Thread Ali Çehreli via Digitalmars-d-learn
On 01/29/2016 05:07 PM, Matt Elkins wrote: > this(/* arguments to populate stuff */) > { > m_this = > /* ... populate stuff ... */ > } > a section in TDPL which said internal pointers are > verboten because objects must be relocatable. Does this mean my example

Re: Dub packages: Best practices for windows support

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Friday, 29 January 2016 at 19:46:40 UTC, Johannes Pfau wrote: Now on windows, things are more complicated. First of all, I can't seem to simply use "libs": ["foo"] as the linker won't find the C import .lib file. Then apparently there's no way to add a library search path with the MSVC

Re: Dub packages: Best practices for windows support

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 30 January 2016 at 01:17:13 UTC, Mike Parker wrote: There's an issue for this at [1]. Until support for -m32mscoff is baked in, distributing any libraries with a dub project will be problematic. [1] https://github.com/D-Programming-Language/dub/issues/628

Re: Dub packages: Best practices for windows support

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 30 January 2016 at 01:17:13 UTC, Mike Parker wrote: Hopefully one day dub will have the ability to pull down library dependencies on demand, or based on the current platform and architecture by default, then this problem goes away. I should say "precompiled library

Re: reduce -> fold?

2016-01-29 Thread deadalnix via Digitalmars-d
On Friday, 29 January 2016 at 23:45:04 UTC, Ola Fosheim Grøstad wrote: So D is adding currying and builtin tuples? :^) Yes. Come back in 10 years it'll be ready for you.

Re: Autocompletion not working on Xamarin Studio for D

2016-01-29 Thread nbro via Digitalmars-d
On Friday, 29 January 2016 at 21:31:35 UTC, Pradeep Gowda wrote: On Friday, 29 January 2016 at 21:05:00 UTC, nbro wrote: Hi! I am trying to write some code in D using Xamarin Studio, but it's not autocompleting the code as I would expect. For example, it does not even gives you

Re: UTF-16 endianess

2016-01-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 29 January 2016 at 22:36:37 UTC, Marek Janukowicz wrote: I have trouble understanding how endianess works for UTF-16. UTF-16 (as well as UTF-32) comes in both little-endian and big-endian variants. A byte-order marker in the file can help you detect which one it is in. See t his

The Quick Mom Algorithm

2016-01-29 Thread Andrei Alexandrescu via Digitalmars-d
http://dpaste.dzfl.pl/05a82699acc8 So over the past few days I've been in the zone working on a smooth implementation of "Median of Medians" (https://en.wikipedia.org/wiki/Median_of_medians). Its performance is much better compared to the straightforward implementation. However, in practice

Re: reduce -> fold?

2016-01-29 Thread Ola Fosheim Grøstad via Digitalmars-d
On Friday, 29 January 2016 at 23:20:38 UTC, Walter Bright wrote: On 1/29/2016 5:11 AM, Luís Marques wrote: Just to bikeshed a little, I remember that when I first started using std.algorithm I was ctrl-F'ing for "accumulate" and not finding it quite often. D competes with C++ directly, so do

To cast a uint to float to compute k/n, use to! or cast()?

2016-01-29 Thread Enjoys Math via Digitalmars-d-learn
I want to compute the points of a regular polygon in a loop: float r = 1.0; for (uint k=0; k < numVerts; k++) { vertlist ~= Vec2D(r * cos(k/n * 2 * PI), ...) } How do I make sure k/n is a float or double?

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Ali Çehreli via Digitalmars-d-learn
On 01/29/2016 09:01 AM, Adrian Matoga wrote: > Oh, there's more: > // this should fail: > static assert(is(CallsFoo!NoFoo)); > // this should fail too: > static assert(is(typeof({ alias Baz = CallsFoo!NoFoo; return Baz.init; > }(; > // and this: > static assert(__traits(compiles, { alias Baz

Re: opApply @safety

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 3:08 PM, Chris Wright wrote: On Fri, 29 Jan 2016 14:00:08 -0500, Steven Schveighoffer wrote: On 1/29/16 12:44 PM, Chris Wright wrote: I want to create an opApply for a type. I've marked my code @safe, because everything I wrote was @safe. The body of opApply is @safe, but it calls

Re: opApply @safety

2016-01-29 Thread Chris Wright via Digitalmars-d-learn
On Fri, 29 Jan 2016 23:35:35 +, Basile B. wrote: > You can implement an input range and annotate all the primitives as > @safe. I hadn't realized that if front() returns a tuple, it's automatically expanded. Works for me.

Re: DMD 2.070.0 - The package is of bad quality

2016-01-29 Thread Zekereth via Digitalmars-d
On Friday, 29 January 2016 at 17:38:18 UTC, Gary Willoughby wrote: I get the following downloading and installing the Ubuntu x86_64 deb file. The package is of bad quality The installation of a package which violates the quality standards isn't allowed. This could cause serious problems on

Re: To cast a uint to float to compute k/n, use to! or cast()?

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 6:48 PM, Enjoys Math wrote: I want to compute the points of a regular polygon in a loop: float r = 1.0; for (uint k=0; k < numVerts; k++) { vertlist ~= Vec2D(r * cos(k/n * 2 * PI), ...) } How do I make sure k/n is a float or double? uint is promoted to float/double with a

Re: UTF-16 endianess

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 5:36 PM, Marek Janukowicz wrote: I have trouble understanding how endianess works for UTF-16. For example UTF-16 code for 'ł' character is 0x0142. But this program shows otherwise: import std.stdio; public void main () { ubyte[] properOrder = [0x01, 0x42]; ubyte[]

Re: reduce -> fold?

2016-01-29 Thread Walter Bright via Digitalmars-d
On 1/29/2016 5:11 AM, Luís Marques wrote: Just to bikeshed a little, I remember that when I first started using std.algorithm I was ctrl-F'ing for "accumulate" and not finding it quite often. D competes with C++ directly, so do consider that name :-) For algorithms and FP in general, we may be

Relocatable objects and internal pointers

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
Hi all, I'm a C++ programmer trying to decide whether to switch my main focus to D, and so I'm working on a pet project using it. So far I really like some of the practical aspects of the language (built-in contracts are great, the metaprogramming is very accessible, and I can't enough of

Re: Vision for the first semester of 2016

2016-01-29 Thread Puming via Digitalmars-d-announce
On Friday, 29 January 2016 at 23:41:47 UTC, Ola Fosheim Grøstad wrote: Yep, a curated list like those awesome-lists found on github would be a start. I've got one before there were many awesome-lists: https://github.com/zhaopuming/awesome-d

Re: Relocatable objects and internal pointers

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 9:35 PM, Matt Elkins wrote: On Saturday, 30 January 2016 at 02:09:55 UTC, Steven Schveighoffer wrote: I figured out a way to have them. You just have to guarantee you don't copy the actual "pointer" out of the struct: https://forum.dlang.org/post/mk5k4l$s5r$1...@digitalmars.com

  1   2   >