Re: Can't pass private symbols as alias parameter

2014-11-16 Thread Freddy via Digitalmars-d
On Sunday, 16 November 2014 at 10:41:20 UTC, deadalnix wrote: module a; struct A(alias foo) { auto foo() { return foo(); } } module b; import a; void main() { auto a = A!bar(); } private int bar() { return 42; } This do not work. I think it is a bug but I see how could

Re: passing duck-typed objects and retaining full type information

2014-11-11 Thread Freddy via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 19:23:39 UTC, Adam Taylor wrote: * i apologize in advance, this is my first post -- the code formatting probably wont turn out so great... I have a bunch of duck typed interfaces for containers similar to what you would find in std.range. i.e. template

Why is size_t not a typedef

2014-11-07 Thread Freddy via Digitalmars-d
Why is size_t an alias and not a typedef(or a struct that is not implictly convertable) test.d void main(){ ulong a; size_t b=a;//only compiles on 64-bit } $ dmd -m64 test $ dmd -m32 test test.d(3): Error: cannot implicitly convert expression (a) of type ulong to uint

Re: New reference type designed to handle templates better

2014-11-05 Thread Freddy via Digitalmars-d
On Wednesday, 5 November 2014 at 19:27:59 UTC, Jonathan Marler wrote: I've been thinking about how to handle templates that have typically been using the 'ref' parameter attribute because they modify the parameter. For example, the put/doPut functions in std.range use the 'ref' attribute for

Re: DIP67: Associative Ranges

2014-10-31 Thread Freddy via Digitalmars-d
On Saturday, 1 November 2014 at 00:04:18 UTC, Jakob Ovrum wrote: On Tuesday, 28 October 2014 at 22:44:32 UTC, Freddy wrote: http://wiki.dlang.org/DIP67 Abstraction over the build-in associative array(one type of range for containers and another type for dynamic generators). Plese criticize.

Re: DIP67: Associative Ranges

2014-10-29 Thread Freddy via Digitalmars-d
On Wednesday, 29 October 2014 at 18:04:30 UTC, John Colvin wrote: On Wednesday, 29 October 2014 at 17:36:41 UTC, H. S. Teoh via Digitalmars-d wrote: On Wed, Oct 29, 2014 at 05:23:07PM +, Brad Anderson via Digitalmars-d wrote: On Wednesday, 29 October 2014 at 06:59:09 UTC, bearophile wrote:

Re: DIP67: Associative Ranges

2014-10-29 Thread Freddy via Digitalmars-d
On Wednesday, 29 October 2014 at 18:40:51 UTC, Freddy wrote: On Wednesday, 29 October 2014 at 18:04:30 UTC, John Colvin wrote: On Wednesday, 29 October 2014 at 17:36:41 UTC, H. S. Teoh via Digitalmars-d wrote: On Wed, Oct 29, 2014 at 05:23:07PM +, Brad Anderson via Digitalmars-d wrote: On

Re: DIP67: Associative Ranges

2014-10-29 Thread Freddy via Digitalmars-d
On Wednesday, 29 October 2014 at 19:55:14 UTC, H. S. Teoh via Digitalmars-d wrote: On Wed, Oct 29, 2014 at 06:40:50PM +, Freddy via Digitalmars-d wrote: On Wednesday, 29 October 2014 at 18:04:30 UTC, John Colvin wrote: On Wednesday, 29 October 2014 at 17:36:41 UTC, H. S. Teoh via

Re: DIP67: Associative Ranges

2014-10-29 Thread Freddy via Digitalmars-d
On Tuesday, 28 October 2014 at 22:44:32 UTC, Freddy wrote: http://wiki.dlang.org/DIP67 Abstraction over the build-in associative array(one type of range for containers and another type for dynamic generators). Plese criticize. Does any one now a better way to implement lazy associative

DIP67: Associative Ranges

2014-10-28 Thread Freddy via Digitalmars-d
http://wiki.dlang.org/DIP67 Abstraction over the build-in associative array(one type of range for containers and another type for dynamic generators). Plese criticize.

Re: How the memory layout of global variable is reliable ?

2014-10-22 Thread Freddy via Digitalmars-d-learn
On Wednesday, 22 October 2014 at 20:29:58 UTC, Cjkp wrote: Hello, I have an idea about a small code tool related to the application resources. It would rely on the assumption that some global variabled, sharing the same type and attributes, declared in group, are contiguous. In short I need

Re: example of pointer usefulness in D

2014-10-21 Thread Freddy via Digitalmars-d
On Tuesday, 21 October 2014 at 12:22:54 UTC, edn wrote: Could someone provide me with examples showing the usefulness of pointers in the D language? They don't seem to be used as much as in C and C++. https://en.wikipedia.org/wiki/XOR_linked_list

How would you dive into a big codebase

2014-10-21 Thread Freddy via Digitalmars-d-learn
Is there any advice/tips for reading medium/big D codebases?

compile time configurations

2014-10-08 Thread Freddy via Digitalmars-d
I recently thought of the idea of using string imports for compile time configuration. Something like this --- import std.stdio; import std.conv; import std.range; import std.algorithm; string getVar(string fname,string var)(){ foreach(property;import(fname).splitter('\n')){

Re: building shared library from D code to import into cython

2014-10-07 Thread Freddy via Digitalmars-d-learn
On Tuesday, 7 October 2014 at 20:55:59 UTC, Laeeth Isharc wrote: Hi. I am trying to create a shared library in D linked against phobos so that I may use this in a cython extension module for Python. Ultimately I would like to be able to use a D class or struct (via the C++ interface) and

Re: RFC: moving forward with @nogc Phobos

2014-09-29 Thread Freddy via Digitalmars-d
On Monday, 29 September 2014 at 10:49:53 UTC, Andrei Alexandrescu wrote: Back when I've first introduced RCString I hinted that we have a larger strategy in mind. Here it is. The basic tenet of the approach is to reckon and act on the fact that memory allocation (the subject of allocators) is

Re: Localizing a D application - best practices?

2014-09-29 Thread Freddy via Digitalmars-d-learn
On Sunday, 28 September 2014 at 21:29:21 UTC, Cliff wrote: Coming from the C# world, all of localization we did was based on defining string resource files (XML-formatted source files which were translated into C# classes with named-string accessors by the build process) that would get

Re: Possible quick win in GC?

2014-09-28 Thread Freddy via Digitalmars-d
On Sunday, 28 September 2014 at 17:47:42 UTC, Abdulhaq wrote: Here's a code snippet which mopefully makes things a bit clearer: /** * In this example the variable foo can be statically analysed as safe to go on the stack. * The new instance of Bar allocated in funcLevelB is only referred to

Re: Dynamically loading a D dynamic library from a c++ program

2014-09-26 Thread Freddy via Digitalmars-d-learn
On Friday, 26 September 2014 at 16:43:30 UTC, Olivier Leduc wrote: Hello, I need to use a C++ SDK to create a plugin an existing closed source c++ application and I would like to know if its possible to use D for that task. Would is be possible to port the SDK header files and call the

Re: Dynamically loading a D dynamic library from a c++ program

2014-09-26 Thread Freddy via Digitalmars-d-learn
On Friday, 26 September 2014 at 16:43:30 UTC, Olivier Leduc wrote: Hello, I need to use a C++ SDK to create a plugin an existing closed source c++ application and I would like to know if its possible to use D for that task. Would is be possible to port the SDK header files and call the

Re: with (auto p = new ...)

2014-09-26 Thread Freddy via Digitalmars-d-learn
On Tuesday, 23 September 2014 at 15:19:59 UTC, Andre wrote: Hi, I just wonder why with (auto p = new ...) is not working. It would be some syntax sugar in this scenario: with (auto p = new Panel()) { parent = this; text = bla;

Re: with (auto p = new ...)

2014-09-26 Thread Freddy via Digitalmars-d-learn
On Friday, 26 September 2014 at 19:59:56 UTC, Freddy wrote: On Tuesday, 23 September 2014 at 15:19:59 UTC, Andre wrote: Hi, I just wonder why with (auto p = new ...) is not working. It would be some syntax sugar in this scenario: with (auto p = new Panel()) {

Re: Library Typedefs are fundamentally broken

2014-09-21 Thread Freddy via Digitalmars-d
Is this supposed to happen? --- import std.typecons; alias feet=Typedef!(float,0.0,feet); alias meter=Typedef!(float,0.0,meter); void main(){ feet a=4.0; meter b=5.0; meter c=a*b;//opps pragma(msg,typeof(c)); } --- $dmd -o- typetest.d Typedef!(float, 0.0F,

Re: Library Typedefs are fundamentally broken

2014-09-21 Thread Freddy via Digitalmars-d
On Sunday, 21 September 2014 at 18:24:53 UTC, Freddy wrote: Is this supposed to happen? --- import std.typecons; alias feet=Typedef!(float,0.0,feet); alias meter=Typedef!(float,0.0,meter); void main(){ feet a=4.0; meter b=5.0; meter c=a*b;//opps

liblzma bindings in dub

2014-09-17 Thread Freddy via Digitalmars-d-learn
How do you include liblzma bindings(https://github.com/D-Programming-Deimos/liblzma) in a dub project?

Library Typedefs are fundamentally broken

2014-09-16 Thread Freddy via Digitalmars-d
When you have separate 2 typedefs of the exact same type, they are equal.While this maybe able to be solved with Typedef!(Typedef!(...)) different modules typedef ing the same type (most likely build-in types) would have their typedef be equivalent thereby degrading the purpose of typedef. ---

Re: Library Typedefs are fundamentally broken

2014-09-16 Thread Freddy via Digitalmars-d
On Wednesday, 17 September 2014 at 03:08:46 UTC, Jakob Ovrum wrote: On Wednesday, 17 September 2014 at 02:57:03 UTC, Freddy wrote: When you have separate 2 typedefs of the exact same type, they are equal.While this maybe able to be solved with Typedef!(Typedef!(...)) different modules typedef

Re: Increasing D's visibility

2014-09-15 Thread Freddy via Digitalmars-d
On Tuesday, 16 September 2014 at 01:43:15 UTC, Andrei Alexandrescu wrote: My understanding of this situation is different. We've wronged the man in the past and a sign of good will from us would go a long way. Andrei What The D community do wrong in the first place?

Mutable array with fixed length

2014-09-04 Thread Freddy via Digitalmars-d-learn
How would you create a mutable array with a fixed(compile error when trying to change) length.

Re: Identifying 32 vs 64 bit OS?

2014-08-11 Thread Freddy via Digitalmars-d-learn
On Monday, 11 August 2014 at 05:19:01 UTC, Jeremy DeHaan wrote: I am looking at these versions as described here: http://dlang.org/version.html There are X86 and X86_64 version identifiers, but these specifically mention that they are versions for the processor type. Can they also be used to

opApply outside of struct/class scope

2014-08-10 Thread Freddy via Digitalmars-d-learn
I'm trying to implement a opApply outside of struct scope struct A{ int[] arr; } int opApply(ref A a,int delegate(ref int) dg){ return 0; } void main(){ A a; foreach(i;a){//i just want it to compile } } when i try compiling, the

Associative Ranges implementation questions

2014-08-08 Thread Freddy via Digitalmars-d
As of now Associative Ranges are defined as: static assert(isInputRange!R); R r=void; auto v=r.front;//r is an input range static assert(isInputRange!(typeof(r.byKey))); auto k=r.byKey.front;//byKey is an input range static assert(is(typeof(v) ==typeof(r[k]) ));//opIndex of k static

Re: Associative Ranges implementation questions

2014-08-08 Thread Freddy via Digitalmars-d
On Saturday, 9 August 2014 at 01:34:38 UTC, Freddy wrote: As of now Associative Ranges are defined as: static assert(isInputRange!R); R r=void; auto v=r.front;//r is an input range static assert(isInputRange!(typeof(r.byKey))); auto k=r.byKey.front;//byKey is an input range static

Re: Associative Ranges

2014-08-04 Thread Freddy via Digitalmars-d
On Monday, 4 August 2014 at 09:21:40 UTC, Marc Schütz wrote: On Sunday, 3 August 2014 at 18:38:51 UTC, Freddy wrote: On Sunday, 3 August 2014 at 08:50:47 UTC, Marc Schütz wrote: 3) For the value and key ranges, there should be a guarantee that they can be zipped through, i.e. that the elements

Re: Associative Ranges

2014-08-04 Thread Freddy via Digitalmars-d
On Tuesday, 5 August 2014 at 00:11:21 UTC, Freddy wrote: On Monday, 4 August 2014 at 09:21:40 UTC, Marc Schütz wrote: On Sunday, 3 August 2014 at 18:38:51 UTC, Freddy wrote: On Sunday, 3 August 2014 at 08:50:47 UTC, Marc Schütz wrote: 3) For the value and key ranges, there should be a

Re: Associative Ranges

2014-08-04 Thread Freddy via Digitalmars-d
On Monday, 4 August 2014 at 09:21:40 UTC, Marc Schütz wrote: On Sunday, 3 August 2014 at 18:38:51 UTC, Freddy wrote: On Sunday, 3 August 2014 at 08:50:47 UTC, Marc Schütz wrote: 3) For the value and key ranges, there should be a guarantee that they can be zipped through, i.e. that the elements

Re: Can't build phobos

2014-08-04 Thread Freddy via Digitalmars-d-learn
On Monday, 4 August 2014 at 10:30:40 UTC, Marc Schütz wrote: On Sunday, 3 August 2014 at 23:41:27 UTC, Freddy wrote: I am currently working on a phobos fork to include associative ranges, however the unittest fail when i try to build. How am a supposed test any unittests that i add.

Re: Associative Ranges

2014-08-03 Thread Freddy via Digitalmars-d
On Friday, 1 August 2014 at 23:57:37 UTC, Freddy wrote: I just curious, do Associative Ranges exist. If so where can i find them. I started thinking about them when i asked this question: http://forum.dlang.org/thread/vauuognmhvtjrktaz...@forum.dlang.org I started a phobos fork for this, what

Re: Associative Ranges

2014-08-03 Thread Freddy via Digitalmars-d
On Sunday, 3 August 2014 at 08:50:47 UTC, Marc Schütz wrote: On Sunday, 3 August 2014 at 06:19:12 UTC, Freddy wrote: On Friday, 1 August 2014 at 23:57:37 UTC, Freddy wrote: I just curious, do Associative Ranges exist. If so where can i find them. I started thinking about them when i asked this

Re: Associative Ranges

2014-08-03 Thread Freddy via Digitalmars-d
On Sunday, 3 August 2014 at 08:50:47 UTC, Marc Schütz wrote: On Sunday, 3 August 2014 at 06:19:12 UTC, Freddy wrote: On Friday, 1 August 2014 at 23:57:37 UTC, Freddy wrote: I just curious, do Associative Ranges exist. If so where can i find them. I started thinking about them when i asked this

Can't build phobos

2014-08-03 Thread Freddy via Digitalmars-d-learn
I am currently working on a phobos fork to include associative ranges, however the unittest fail when i try to build. How am a supposed test any unittests that i add. link:https://github.com/Superstar64/phobos/tree/associative_ranges $ ../dmd/src/dmd |head -1 DMD32 D Compiler

Re: Associative Ranges

2014-08-02 Thread Freddy via Digitalmars-d
On Saturday, 2 August 2014 at 15:46:31 UTC, Xinok wrote: On Saturday, 2 August 2014 at 14:49:49 UTC, bearophile wrote: Xinok: I do wonder if we should generalize an interface for these types of ranges. First of all you need some use cases and usage examples. Bye, bearophile The most

Associative Ranges

2014-08-01 Thread Freddy via Digitalmars-d
I just curious, do Associative Ranges exist. If so where can i find them. I started thinking about them when i asked this question: http://forum.dlang.org/thread/vauuognmhvtjrktaz...@forum.dlang.org

Is there a way to map associative arrays

2014-08-01 Thread Freddy via Digitalmars-d-learn
#!/usr/bin/rdmd import std.algorithm; import std.stdio; uint[uint] test; void main(){ test=[0:2 ,1:3 ,2:4]; writeln(test.map!(a=a-2)); } $ ./test.d ./test.d(8): Error: template std.algorithm.map cannot deduce function from argument types !((a) = a - 2)(uint[uint]), candidates

Re: Is there a way to map associative arrays

2014-08-01 Thread Freddy via Digitalmars-d-learn
On Friday, 1 August 2014 at 23:22:06 UTC, bearophile wrote: Freddy: uint[uint] test; void main(){ test=[0:2 ,1:3 ,2:4]; writeln(test.map!(a=a-2)); } If you need keys or values you have .keys .values, .byKey, .byValue (the first two are eager). If you need both you are out

Tornado pool-Work in progress template streaming library

2014-07-08 Thread Freddy via Digitalmars-d-announce
link: https://github.com/Superstar64/tornado-pool This is a heavy work in progress streaming library, i'm not even sure if some parts of it compile. check out tpool/samples.d

<    1   2