Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Nordlöw via Digitalmars-d-learn
On Saturday, 17 February 2018 at 14:54:37 UTC, ag0aep6g wrote: Nordlöw's methods are only weakly pure. They have mutable indirections either in the return type or in a parameter type. So calls to them should not be optimized away. I found a solution at

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-17 Thread Jordi Sayol via Digitalmars-d-learn
El 17/02/18 a les 18:49, Martin Tschierschke via Digitalmars-d-learn ha escrit: > But the installation via apt-get is not working without the steps already > mentioned in the post before! (s/http/https/  and manually import of the > public key) "d-apt.list" file fixed! (s/http/https/) d-apt

Re: Visual D >> TRACKER : error TRK0004: Failed to locate: "FileTracker32.dll". The system cannot find the file specified.

2018-02-17 Thread Saravana Kumar Arumugam via Digitalmars-d-learn
On Saturday, 17 February 2018 at 20:30:16 UTC, Saravana Kumar Arumugam wrote: ...Make sure you also renamed the file "FileTrackerUI.dll" to "FileTracker32UI.dll" in the latest LCID folder... Don't forget to make copy!! That'll bring you even more problems while compiling other projects! It

Re: Visual D >> TRACKER : error TRK0004: Failed to locate: "FileTracker32.dll". The system cannot find the file specified.

2018-02-17 Thread Saravana Kumar Arumugam via Digitalmars-d-learn
On Friday, 2 February 2018 at 08:56:45 UTC, Markus wrote: On Tuesday, 21 November 2017 at 04:39:52 UTC, A Guy With a Question wrote: I'm trying to learn D using Visual D in Visual Studio Community 2015. Both dmd and ldc give me this error when building from Visual Studio. Any ideas? I'm able

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/17/18 9:54 AM, ag0aep6g wrote: On 02/17/2018 03:04 PM, Steven Schveighoffer wrote: You have to be a bit careful here. pure functions can assume nothing is happening and simply not call the function. That's only a problem when the called function is strongly pure, right? Nordlöw's

Re: confused with data types

2018-02-17 Thread arturg via Digitalmars-d-learn
double[][] skalar_m_2d(double[][] arr, double skalar) { import std.algorithm; // return arr.map(a=> a[] *= skalar).array; arr.each!((ref a) => a[] *= skalar)); return arr; }

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-17 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 14 February 2018 at 11:23:48 UTC, Andrea Fontana wrote: On Wednesday, 14 February 2018 at 11:16:25 UTC, Martin Tschierschke wrote: Ok, good to know! I started with 16.04 and made the initial mistake to take the 32 Bit version, do you use 32 or 64 Bit? 64bit of course! Andrea

Re: confused with data types

2018-02-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 17 February 2018 at 16:12:48 UTC, thorstein wrote: public double[][] skalar_m_2d(double[][] array, double skalar) { return array.map!(b => b[].map!(c => c * skalar)); } It'd probably be better to just do that in-place... foreach(row; array) row[] *= skalar; return array;

Re: confused with data types

2018-02-17 Thread JN via Digitalmars-d-learn
On Saturday, 17 February 2018 at 16:12:48 UTC, thorstein wrote: Hello, This was my goal: - public double[][] skalar_m_2d(double[][] array, double skalar) { return array.map!(b => b[].map!(c => c * skalar)); } !!! But: return value is not double! Type check for return value:

confused with data types

2018-02-17 Thread thorstein via Digitalmars-d-learn
Hello, This was my goal: - public double[][] skalar_m_2d(double[][] array, double skalar) { return array.map!(b => b[].map!(c => c * skalar)); } !!! But: return value is not double! Type check for return value: a = array.map!(b => b[].map!(c => c

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Eduard Staniloiu via Digitalmars-d-learn
On Saturday, 17 February 2018 at 12:33:25 UTC, Nordlöw wrote: I'm struggling with making https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d callable in pure functions such as here https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d#L84 Shouldn't a

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread ag0aep6g via Digitalmars-d-learn
On 02/17/2018 03:04 PM, Steven Schveighoffer wrote: You have to be a bit careful here. pure functions can assume nothing is happening and simply not call the function. That's only a problem when the called function is strongly pure, right? Nordlöw's methods are only weakly pure. They have

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/17/18 8:32 AM, ag0aep6g wrote: On 02/17/2018 01:35 PM, rikki cattermole wrote: pure means no globals. As in none :) ... except immutable ones. And since PureMallocator has no fields, `instance` can be made immutable, and all the methods can be made static or const. Then they can be

Re: Return value in BetterC mode.

2018-02-17 Thread meppl via Digitalmars-d-learn
On Saturday, 17 February 2018 at 07:58:40 UTC, ANtlord wrote: Hello! Yesterday I found an interesting issue for myself while I was implementing unique pointer for my project in BetterC. When I was trying to return new instance from a `move` method I got calling of destructor the instance.

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/17/18 7:33 AM, Nordlöw wrote: I'm struggling with making https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d callable in pure functions such as here https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d#L84 Shouldn't a shared     static

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread ag0aep6g via Digitalmars-d-learn
On 02/17/2018 01:35 PM, rikki cattermole wrote: pure means no globals. As in none :) ... except immutable ones. And since PureMallocator has no fields, `instance` can be made immutable, and all the methods can be made static or const. Then they can be used in `pure` code.

Re: Faking a non-pure function as pure

2018-02-17 Thread Nordlöw via Digitalmars-d-learn
On Friday, 16 February 2018 at 18:03:40 UTC, Ali Çehreli wrote: auto pureF = assumePure(); pureF(42); Ali Thanks!

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Nordlöw via Digitalmars-d-learn
On Saturday, 17 February 2018 at 12:35:00 UTC, rikki cattermole wrote: in pure functions? pure means no globals. As in none :) I guess one solution is to make the member functions in PureMallocator static and change how the template argument `Allocator` for a container is used to call

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread rikki cattermole via Digitalmars-d-learn
On 17/02/2018 12:48 PM, Nordlöw wrote: On Saturday, 17 February 2018 at 12:35:00 UTC, rikki cattermole wrote: in pure functions? pure means no globals. As in none :) I don't understand. I thought std.experimental.allocators API was designed to be able express these needs, @andralex?

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Nordlöw via Digitalmars-d-learn
On Saturday, 17 February 2018 at 12:35:00 UTC, rikki cattermole wrote: in pure functions? pure means no globals. As in none :) I don't understand. I thought std.experimental.allocators API was designed to be able express these needs, @andralex?

Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Nordlöw via Digitalmars-d-learn
I'm struggling with making https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d callable in pure functions such as here https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d#L84 Shouldn't a shared static shared PureMallocator instance; make it

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread Nordlöw via Digitalmars-d-learn
On Saturday, 17 February 2018 at 12:33:25 UTC, Nordlöw wrote: PureMallocator.instance.allocate(16); currently errors as pure_mallocator.d(84,16): Error: pure function 'pure_mallocator.__unittest_pure_mallocator_82_0' cannot access mutable static data 'instance'

Re: Cannot make my shared PureMallocator callable in pure functions

2018-02-17 Thread rikki cattermole via Digitalmars-d-learn
On 17/02/2018 12:33 PM, Nordlöw wrote: I'm struggling with making https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d callable in pure functions such as here https://github.com/nordlow/phobos-next/blob/master/src/pure_mallocator.d#L84 Shouldn't a shared     static

Return value in BetterC mode.

2018-02-17 Thread ANtlord via Digitalmars-d-learn
Hello! Yesterday I found an interesting issue for myself while I was implementing unique pointer for my project in BetterC. When I was trying to return new instance from a `move` method I got calling of destructor the instance. When the instance is out of scope the calling is happens again. I