On Wednesday, 9 March 2016 at 03:05:52 UTC, rcorre wrote:
I was in a situation where I wanted to remove duplicates from
an OnlyResult.
To do this with uniq, I needed to sort it. OnlyResult doesn't
satisfy the template constraints of sort, but this seems easy
enough to fix. I made front, back, a
If I understand purity correctly
(http://klickverbot.at/blog/2012/05/purity-in-d/), every function
out there can be marked pure as long as it doesn't modify
globals, shared variables or do I/O?
It seems more function can be marked pure that I previously
thought.
On Wednesday, 9 March 2016 at 09:56:05 UTC, Guillaume Piolat
wrote:
If I understand purity correctly
(http://klickverbot.at/blog/2012/05/purity-in-d/), every
function out there can be marked pure as long as it doesn't
modify globals, shared variables or do I/O?
It seems more function can be m
On 09.03.2016 10:56, Guillaume Piolat wrote:
If I understand purity correctly
(http://klickverbot.at/blog/2012/05/purity-in-d/), every function out
there can be marked pure as long as it doesn't modify globals, shared
variables or do I/O?
Pure functions also can't *read* mutable globals. But th
On 09.03.2016 10:57, Guillaume Piolat wrote:
Another question that ensues is: will the compiler prevent incorrect use
of pure, so that it's safe to spam it in your code?
The compiler should catch wrong usage of `pure`, yes. Function
declarations without implementation are an exception, of cour
On Wednesday, 9 March 2016 at 10:08:33 UTC, ag0aep6g wrote:
On 09.03.2016 10:56, Guillaume Piolat wrote:
If I understand purity correctly
(http://klickverbot.at/blog/2012/05/purity-in-d/), every
function out
there can be marked pure as long as it doesn't modify globals,
shared
variables or do
Potential for leaking references from alias this aside, is there
some reason that I shouldn't do this for all my C++-like RAII
needs:
class A
{
~this(){ import std.stdio; writeln("hello"); }
}
auto RAII(T)()
if (is(T == class))
{
struct Inner
{
private u
On Wednesday, 9 March 2016 at 10:28:06 UTC, John Colvin wrote:
Potential for leaking references from alias this aside, is
there some reason that I shouldn't do this for all my C++-like
RAII needs:
class A
{
~this(){ import std.stdio; writeln("hello"); }
}
auto RAII(T)()
if (is(T == cl
On Wednesday, 9 March 2016 at 10:48:30 UTC, cym13 wrote:
On Wednesday, 9 March 2016 at 10:28:06 UTC, John Colvin wrote:
Potential for leaking references from alias this aside, is
there some reason that I shouldn't do this for all my C++-like
RAII needs:
class A
{
~this(){ import std.s
Dne 9.3.2016 v 11:26 Guillaume Piolat via Digitalmars-d-learn napsal(a):
On Wednesday, 9 March 2016 at 10:08:33 UTC, ag0aep6g wrote:
On 09.03.2016 10:56, Guillaume Piolat wrote:
If I understand purity correctly
(http://klickverbot.at/blog/2012/05/purity-in-d/), every function out
there can be
On Wednesday, 9 March 2016 at 09:15:01 UTC, Edwin van Leeuwen
wrote:
I'm not sure why your fix didn't work, but generally I work
around this by converting the OnlyResult into an array:
import std.array : array;
assert(only(3,1,2).array.sort.equal(only(1,2,3)));
I'd like to avoid allocating
On Wednesday, 9 March 2016 at 12:21:55 UTC, rcorre wrote:
If you are looking for a lazy uniq that works on non sorted
ranges, I implemented one not to long ago:
http://github.com/BlackEdder/ggplotd/blob/master/source/ggplotd/range.d
That sounds like the kind of thing I was looking for. I'll ta
On Wednesday, 9 March 2016 at 12:31:18 UTC, Edwin van Leeuwen
wrote:
On Wednesday, 9 March 2016 at 12:21:55 UTC, rcorre wrote:
If you are looking for a lazy uniq that works on non sorted
ranges, I implemented one not to long ago:
http://github.com/BlackEdder/ggplotd/blob/master/source/ggplotd/r
On Wednesday, March 09, 2016 09:56:05 Guillaume Piolat via Digitalmars-d-learn
wrote:
> If I understand purity correctly
> (http://klickverbot.at/blog/2012/05/purity-in-d/), every function
> out there can be marked pure as long as it doesn't modify
> globals, shared variables or do I/O?
>
> It see
On Wednesday, 9 March 2016 at 13:04:31 UTC, rcorre wrote:
On Wednesday, 9 March 2016 at 12:31:18 UTC, Edwin van Leeuwen
wrote:
On Wednesday, 9 March 2016 at 12:21:55 UTC, rcorre wrote:
If you are looking for a lazy uniq that works on non sorted
ranges, I implemented one not to long ago:
http:/
On Wednesday, 9 March 2016 at 13:12:18 UTC, Jonathan M Davis
wrote:
In general though, you should use pure wherever possible.
- Jonathan M Davis
Thanks for the detailed answer and gotchas.
It thought compilers would use pure in alias analysis to ensure
everything did not mutate during a pure
On Wednesday, 9 March 2016 at 12:21:55 UTC, rcorre wrote:
On Wednesday, 9 March 2016 at 09:15:01 UTC, Edwin van Leeuwen
wrote:
I'm not sure why your fix didn't work, but generally I work
around this by converting the OnlyResult into an array:
import std.array : array;
assert(only(3,1,2).arra
I've studied [1] and [2] but don't understand everything there.
Hence these dumb questions:
Given
enum n = 100_000_000; // some big number
auto a = new ulong[](n);
auto b = new char[8][](n);
struct S { ulong x; char[8] y; }
auto c = new S[](n);
will the large memory blocks allocated
On Tuesday, 8 March 2016 at 23:13:32 UTC, Anon wrote:
On Tuesday, 8 March 2016 at 20:26:04 UTC, Yuxuan Shui wrote:
[...]
[Note: I phrase my answer in terms of Linux shared libraries
(*.so) because D doesn't actually have proper Windows DLL
support yet. The same would apply to DLLs, it just f
On Wednesday, 9 March 2016 at 14:28:11 UTC, cym13 wrote:
On Wednesday, 9 March 2016 at 12:21:55 UTC, rcorre wrote:
On Wednesday, 9 March 2016 at 09:15:01 UTC, Edwin van Leeuwen
wrote:
I'm not sure why your fix didn't work, but generally I work
around this by converting the OnlyResult into an
On Wednesday, 9 March 2016 at 15:39:55 UTC, rcorre wrote:
On Wednesday, 9 March 2016 at 14:28:11 UTC, cym13 wrote:
Still curious as to why it fails; maybe the range is getting
copied at some point? I guess I need to step through it.
I did try different SwapStrategies with no luck.
Since you
On Wednesday, 9 March 2016 at 15:14:02 UTC, Gerald Jansen wrote:
will the large memory blocks allocated for a, b and/or c
actually be scanned for pointers to GC-allocated memory during
a garbage collection? If so, why?
No. It knows that the type has no pointers in it, so it will not
scan it f
On Wednesday, 9 March 2016 at 14:28:11 UTC, cym13 wrote:
Note that an input range isn't even remotely a container, it's
a way to iterate on a container. As you don't have all elements
at hand you can't sort them, that's why you have to use array
here.
Oh, I think it just clicked. I was thin
Hello, I have followed the instructions here
(http://wiki.dlang.org/Starting_as_a_Contributor#POSIX) to
install DMD, druntime and phobos from source.
My platform is Ubuntu 15.10 x64.
This is the error I get:
http://pastebin.com/kWCv0ymn
On Wednesday, 9 March 2016 at 16:13:38 UTC, Minas Mina wrote:
Hello, I have followed the instructions here
(http://wiki.dlang.org/Starting_as_a_Contributor#POSIX) to
install DMD, druntime and phobos from source.
My platform is Ubuntu 15.10 x64.
This is the error I get:
http://pastebin.com/kWC
On Wednesday, 9 March 2016 at 15:39:55 UTC, rcorre wrote:
Still curious as to why it fails; maybe the range is getting
copied at some point? I guess I need to step through it.
That's my suspicion as well. It seems that OnlyResult is
pass-by-value so every time it gets passed to another functio
On Wed, 09 Mar 2016 14:28:11 +, cym13 wrote:
> Note that an input range isn't even remotely a container
Which is why sort() has template constraints beyond isInputRange. The
constraints ensure that it is possible to swap values in the range.
On Wed, 09 Mar 2016 15:50:43 +, Adam D. Ruppe wrote:
> Or static
> arrays of int on the stack will also be scanned, since the GC doesn't
> actually know much about local variables
It's especially tricky because compilers can reuse memory on the stack
-- for instance, if I use one variable in
Dear list,
I use DMD 2.070.0 I try to access COM Interfaces via the declarations in
core.sys.windows.*
I have some problems and maybe someone could give me a usage hint.
Have a look at the following (relatively meaningless) sample program
which demonstrates the problem.
IMHO the problem is t
On Wed, Mar 09, 2016 at 05:12:18AM -0800, Jonathan M Davis via
Digitalmars-d-learn wrote:
[...]
> So, in general, you can slap pure on most anything, though it will
> rarely buy you anything in terms of performance.
IMO, this is an area where the compiler could be improved to take better
advantag
On Tuesday, 8 March 2016 at 18:11:24 UTC, John wrote:
* For this kind of implementation, is the Algebraic type a good
choice ? Is a simple union perhaps better ?
You can go with Algebraic. I used to do that in scheme-d. Then I
switched to a tagged union by hand to avoid a compiler
regressio
On 03/09/2016 10:35 AM, KlausO wrote:
> IUnknown pUnk;
>
> //
> // Does not compile:
> //
> // Error: function
> core.sys.windows.unknwn.IUnknown.QueryInterface(const(GUID)* riid,
> void** pvObject) is not callable using argument types (const(GUID),
On 03/09/2016 07:05 AM, Yuxuan Shui wrote:
> Can we left TypeInfo symbol undefined in the shared libraries? i.e. D
> compiler will strip out TypeInfo definition when creating .so.
> (Alternatively, we can have TypeInfo always undefined in .o, and
> generate them in linking stage only when creatin
On Tuesday, 8 March 2016 at 12:25:36 UTC, Ola Fosheim Grøstad
wrote:
On Tuesday, 8 March 2016 at 08:12:04 UTC, Nordlöw wrote:
sparse_hash_set<> contained in
https://github.com/sparsehash/sparsehash
It appears to be very slow?
What do you need it for?
My knowledge database engine I'm buildin
On Wednesday, 9 March 2016 at 22:26:38 UTC, Ali Çehreli wrote:
On 03/09/2016 07:05 AM, Yuxuan Shui wrote:
> Can we left TypeInfo symbol undefined in the shared
libraries? i.e. D
> compiler will strip out TypeInfo definition when creating .so.
> (Alternatively, we can have TypeInfo always undefin
On Thu, Mar 10, 2016 at 01:33:41AM +, Yuxuan Shui via Digitalmars-d-learn
wrote:
> On Wednesday, 9 March 2016 at 22:26:38 UTC, Ali Çehreli wrote:
> >On 03/09/2016 07:05 AM, Yuxuan Shui wrote:
> >
> >> Can we left TypeInfo symbol undefined in the shared libraries? i.e.
> >> D compiler will stri
On Wednesday, 9 March 2016 at 16:53:08 UTC, Xinok wrote:
On Wednesday, 9 March 2016 at 15:39:55 UTC, rcorre wrote:
Still curious as to why it fails; maybe the range is getting
copied at some point? I guess I need to step through it.
That's my suspicion as well. It seems that OnlyResult is
pas
So i want bitfields for just a little bit. but i dont want its
dependencies. How is it done. I have tried this. but it doesnt
seem to work on gdc. :(
struct Color_t {
static if(__ctfe){
import std.bitmanip:bitfields;
}
mixin(bitfields!(
ui
On Thursday, 10 March 2016 at 04:07:54 UTC, Taylor Hillegeist
wrote:
So i want bitfields for just a little bit. but i dont want its
dependencies. How is it done. I have tried this. but it doesnt
seem to work on gdc. :(
struct Color_t {
static if(__ctfe){
import std.bitm
On Thursday, 10 March 2016 at 04:56:52 UTC, Mike Parker wrote:
On Thursday, 10 March 2016 at 04:07:54 UTC, Taylor Hillegeist
wrote:
So i want bitfields for just a little bit. but i dont want its
dependencies. How is it done. I have tried this. but it doesnt
seem to work on gdc. :(
struct Colo
On 03/09/2016 06:50 PM, rcorre wrote:
> sort calls to quicksort (for unstable, at least) which uses
> swapAt. swapAt takes the range by value, so it just swaps the values in
> its local copy.
Remembering that a range is not the collection, swapAt takes the range
by value but it does not copy th
41 matches
Mail list logo