Re: Tagged enums why reserved words are not permitted ?

2014-10-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2014-10-28 01:51, Jonathan M Davis via Digitalmars-d-learn wrote: And I've never seen a language where it did (though one may exist out there somewhere) Ruby: class Foo end Foo == Foo.new.class # perfectly legal You always need to have a receiver when calling the class method. This is

Re: Implementing SmartPtr - compiler bug?

2014-10-28 Thread Szymon Gatner via Digitalmars-d-learn
On Monday, 27 October 2014 at 18:42:11 UTC, Marc Schütz wrote: On Monday, 27 October 2014 at 16:58:56 UTC, Szymon Gatner wrote: On Monday, 27 October 2014 at 14:04:53 UTC, Marc Schütz wrote: On Monday, 27 October 2014 at 12:40:17 UTC, Shachar Shemesh wrote: On 27/10/14 11:31, Szymon Gatner

Re: Embedding D Shared Library in WSGI Web Server

2014-10-28 Thread Chris via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 00:16:03 UTC, John McFarlane wrote: Hi, I've written a modest shared library in D that I'd like to call directly from a Python web server (Linux/OS X, Apache, WSGI, Pyramid). I can call it reliably from within Python unit tests but on a running server, the

Re: HTML Parsing lib

2014-10-28 Thread Chris via Digitalmars-d-learn
On Sunday, 26 October 2014 at 06:20:45 UTC, Suliman wrote: Unfortunately that library has no dub package. But you can include it in your project. See info here http://code.dlang.org/package-format I can't understand how to set in dub that I need to to include in compilation process other

Re: Implementing SmartPtr - compiler bug?

2014-10-28 Thread via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 08:36:07 UTC, Szymon Gatner wrote: On Monday, 27 October 2014 at 18:42:11 UTC, Marc Schütz wrote: On Monday, 27 October 2014 at 16:58:56 UTC, Szymon Gatner wrote: On Monday, 27 October 2014 at 14:04:53 UTC, Marc Schütz wrote: On Monday, 27 October 2014 at

Re: Creation of 0MQ D project

2014-10-28 Thread via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 00:21:20 UTC, anonymous wrote: On Monday, 27 October 2014 at 23:56:11 UTC, Evan Lowry wrote: ../../.dub/packages/zeromq-master/deimos/zmq/zmq.d(96): Error: function deimos.zmq.zmq.zmq_strerror without 'this' cannot be const You found a bug in the binding. Line

Re: Reflections on isPalindrome

2014-10-28 Thread MattCoder via Digitalmars-d-learn
Hi, I don't know if I'm missing something but I did some tests with the popFront and popBack version: bool isPalindrome(R)(R range) if (isBidirectionalRange!(R)) { while (!range.empty){ if (range.front != range.back) return false; range.popFront();

Re: Reflections on isPalindrome

2014-10-28 Thread MattCoder via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 11:48:37 UTC, MattCoder wrote: And in my benchmark test, the first version is 3x slower than the second one. I forgot to say that I'm compiling with DMD without any compiler hints/optimizations. Matheus.

Re: Reflections on isPalindrome

2014-10-28 Thread Andrea Fontana via Digitalmars-d-learn
On Monday, 27 October 2014 at 22:53:57 UTC, Nordlöw wrote: Why bidirectional range only? popBack() only for I mean: you should write a different version for non-bidirectional ranges too :)

Re: Tagged enums why reserved words are not permitted ?

2014-10-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/27/14 8:31 PM, Domingo wrote: Hello ! I'm not sure if I'm missing something here but for a tagged enum it doesn't seem to make sense to forbid reserved keywords like: enum CrudOps {read, write, delete} The dmd compiler are complaining: -- cte.d(4): Error: basic type expected, not

Re: Reflections on isPalindrome

2014-10-28 Thread Nordlöw
On Tuesday, 28 October 2014 at 11:51:42 UTC, MattCoder wrote: I forgot to say that I'm compiling with DMD without any compiler hints/optimizations. Try compiling with DMD flag -release and perhaps also -release -noboundscheck to get relevant results. DMD is currently not that good at

More uses of operator in

2014-10-28 Thread Nordlöw
Has there been any proposals/plans to make operator in work for elements in ranges such as assert('x' in ['x']); I'm missing that Python feature when I work in D.

Re: Reflections on isPalindrome

2014-10-28 Thread MattCoder via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 13:30:05 UTC, Nordlöw wrote: On Tuesday, 28 October 2014 at 11:51:42 UTC, MattCoder wrote: I forgot to say that I'm compiling with DMD without any compiler hints/optimizations. Try compiling with DMD flag -release and perhaps also -release -noboundscheck to

Re: More uses of operator in

2014-10-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/28/14 9:50 AM, Nordlöw wrote: Has there been any proposals/plans to make operator in work for elements in ranges such as assert('x' in ['x']); I'm missing that Python feature when I work in D. No. The implication of 'in' for AAs is that it is a fast, O(lgn) or better, operation.

Re: More uses of operator in

2014-10-28 Thread Baz via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 13:50:24 UTC, Nordlöw wrote: Has there been any proposals/plans to make operator in work for elements in ranges such as assert('x' in ['x']); I'm missing that Python feature when I work in D. There is also something similar in Pascal, at the language

Re: More uses of operator in

2014-10-28 Thread Nordlöw
On Tuesday, 28 October 2014 at 14:06:27 UTC, Steven Schveighoffer wrote: No. The implication of 'in' for AAs is that it is a fast, O(lgn) or better, operation. Your assertion requires O(n) performance. What about making it work for (builtin) tuples? Then it could be make use of a variadic

Accessing D globals in C

2014-10-28 Thread Thad via Digitalmars-d-learn
Hello, I am mixing some of my existing C code with D via static linking. I can access C globals from D using __gshared but I cannot seem to be able to access a D global from within the C code. Keep in mind I am a novice programmer. Everything is built with gcc and gdc under Linux. e.g. //D

Re: Reflections on isPalindrome

2014-10-28 Thread Nordlöw
On Tuesday, 28 October 2014 at 14:09:50 UTC, MattCoder wrote: Now with: -release -noboundscheck they are equal and sometimes your version is slightly faster by ~3 milliseconds. That is great to hear! You should try profiling with ldc aswell.

Re: Reflections on isPalindrome

2014-10-28 Thread MachineCode via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 14:09:50 UTC, MattCoder wrote: On Tuesday, 28 October 2014 at 13:30:05 UTC, Nordlöw wrote: On Tuesday, 28 October 2014 at 11:51:42 UTC, MattCoder wrote: I forgot to say that I'm compiling with DMD without any compiler hints/optimizations. Try compiling with DMD

Re: More uses of operator in

2014-10-28 Thread via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 15:11:01 UTC, Baz wrote: On Tuesday, 28 October 2014 at 13:50:24 UTC, Nordlöw wrote: Has there been any proposals/plans to make operator in work for elements in ranges such as assert('x' in ['x']); I'm missing that Python feature when I work in D. There is

Re: Accessing D globals in C

2014-10-28 Thread via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 15:24:03 UTC, Thad wrote: Hello, I am mixing some of my existing C code with D via static linking. I can access C globals from D using __gshared but I cannot seem to be able to access a D global from within the C code. Keep in mind I am a novice programmer.

Re: Tagged enums why reserved words are not permitted ?

2014-10-28 Thread Gary Willoughby via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 00:51:17 UTC, Jonathan M Davis via Digitalmars-d-learn The thing that's been done in Phobos in this type of situation is to put an underscore on the end of the keyword, so you'd get enum CrudOps { read, write, delete_ } and while that may not be what you want,

Re: Accessing D globals in C

2014-10-28 Thread Thad via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 16:42:20 UTC, Marc Schütz wrote: On Tuesday, 28 October 2014 at 15:24:03 UTC, Thad wrote: Hello, I am mixing some of my existing C code with D via static linking. I can access C globals from D using __gshared but I cannot seem to be able to access a D global

Re: Problems with Mutex

2014-10-28 Thread Sean Kelly via Digitalmars-d-learn
On Monday, 27 October 2014 at 19:13:13 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: The reason that it's not shared is because Sean Kelly didn't want to make much of anything in druntime shared until shared was better ironed out, which keeps getting talked about but never done.

Re: More uses of operator in

2014-10-28 Thread Baz via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 16:32:13 UTC, Marc Schütz wrote: On Tuesday, 28 October 2014 at 15:11:01 UTC, Baz wrote: On Tuesday, 28 October 2014 at 13:50:24 UTC, Nordlöw wrote: Has there been any proposals/plans to make operator in work for elements in ranges such as assert('x' in

Re: More uses of operator in

2014-10-28 Thread via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 17:50:30 UTC, Baz wrote: On Tuesday, 28 October 2014 at 16:32:13 UTC, Marc Schütz wrote: On Tuesday, 28 October 2014 at 15:11:01 UTC, Baz wrote: On Tuesday, 28 October 2014 at 13:50:24 UTC, Nordlöw wrote: Has there been any proposals/plans to make operator in

Re: More uses of operator in

2014-10-28 Thread Nordlöw
On Tuesday, 28 October 2014 at 18:29:49 UTC, Marc Schütz wrote: It always was the argument against generalizing `in` to arrays. `in` is not alone in this respect. It's also expected that indexing and slicing be cheap operations. BTW: Does anybody have an efficient unordered set container

Re: More uses of operator in

2014-10-28 Thread via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 18:29:49 UTC, Marc Schütz wrote: On Tuesday, 28 October 2014 at 17:50:30 UTC, Baz wrote: On Tuesday, 28 October 2014 at 16:32:13 UTC, Marc Schütz wrote: On Tuesday, 28 October 2014 at 15:11:01 UTC, Baz wrote: On Tuesday, 28 October 2014 at 13:50:24 UTC, Nordlöw

Re: More uses of operator in

2014-10-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/28/14 2:33 PM, Nordlöw wrote: On Tuesday, 28 October 2014 at 18:29:49 UTC, Marc Schütz wrote: It always was the argument against generalizing `in` to arrays. `in` is not alone in this respect. It's also expected that indexing and slicing be cheap operations. BTW: Does anybody have an

Re: More uses of operator in

2014-10-28 Thread via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 14:06:27 UTC, Steven Schveighoffer wrote: On 10/28/14 9:50 AM, Nordlöw wrote: Has there been any proposals/plans to make operator in work for elements in ranges such as assert('x' in ['x']); … Your assertion requires O(n) performance. It is O(ln(n)) on

Re: More uses of operator in

2014-10-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/28/14 3:45 PM, Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= ola.fosheim.grostad+dl...@gmail.com wrote: On Tuesday, 28 October 2014 at 14:06:27 UTC, Steven Schveighoffer wrote: On 10/28/14 9:50 AM, Nordlöw wrote: Has there been any proposals/plans to make operator in work for elements in ranges

Re: Tagged enums why reserved words are not permitted ?

2014-10-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 28, 2014 16:58:50 Gary Willoughby via Digitalmars-d-learn wrote: On Tuesday, 28 October 2014 at 00:51:17 UTC, Jonathan M Davis via Digitalmars-d-learn The thing that's been done in Phobos in this type of situation is to put an underscore on the end of the keyword,

Re: More uses of operator in

2014-10-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 28, 2014 18:38:18 via Digitalmars-d-learn wrote: To answer your question: Computational (or memory) complexity is not an implementation detail, because it has a very noticeable effect. Therefore, one should not hide an O(n) or worse operation behind a harmless looking

Using imm8 through inline assembler

2014-10-28 Thread Etienne via Digitalmars-d-learn
I'm trying to write (in DMD) the assembler that handles the function : __m256i _mm256_permute4x64_epi64(__m256i a, in int M); This translates to vpermq The closest thing I could find in DMD assembly is VPERMILPS, which is called with: asm { vpermilps YMM0, YMM1, IMM8; } However, I cannot

Re: More uses of operator in

2014-10-28 Thread Nordlöw
On Tuesday, 28 October 2014 at 19:24:00 UTC, Steven Schveighoffer wrote: https://github.com/schveiguy/dcollections/blob/master/dcollections/HashSet.d -Steve Thanks!

Re: Using imm8 through inline assembler

2014-10-28 Thread anonymous via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 21:05:15 UTC, Etienne wrote: I'm trying to write (in DMD) the assembler that handles the function : __m256i _mm256_permute4x64_epi64(__m256i a, in int M); This translates to vpermq The closest thing I could find in DMD assembly is VPERMILPS, which is called

Re: Using imm8 through inline assembler

2014-10-28 Thread Etienne Cimon via Digitalmars-d-learn
imm8 is not a register. imm stands for immediate, i.e. a constant, hard-coded value. E.g.: asm { vpermilps YMM0, YMM1, 0 /* no idea what would be a meaningful value */; } Oh, well, that makes sense. This means I should use string mixins to insert the actual value. I couldn't run AVX2

Is Apple LLVM 6 compatible with LDC

2014-10-28 Thread JJDuck via Digitalmars-d-learn
I'm trying to compile my D code using LDC and hopefully used by my iOS program in Xcode. So I did some research (correct me if I'm wrong) If I compile my D code using LDC into static file and used by my iOS app and since they have the same compiler backend, are they binary compatible? If it

dub fetch target redirection...

2014-10-28 Thread WhatMeWorry via Digitalmars-d-learn
It looks like dub fetch... is putting all packages at %appdata% path on my windows machine. Is there a way to redirect packages to a user specified path?