Re: Sending an immutable object to a thread

2015-07-18 Thread Frank Pagliughi via Digitalmars-d-learn
OK, I found a couple of solutions, though if anyone can tell me something better, I would love to hear it. By making an alias to a rebindable reference, the receive() was able to create the tuple. So I renamed the class "MessageType": class MessageType { ... }; and then made a "Message"

Re: VisualD building with GDC setting library path

2015-07-18 Thread Rainer Schuetze via Digitalmars-d-learn
On 18.07.2015 15:07, kerdemdemir wrote: Hi, I am tring to build Cristi Cobzarenco's fork of Scid which has LAPACK,BLAS dependency. I add all modules of Scid to my project and I am tring to build it within my project. I add LibraryFiles: liblapack.a libblas.a libtmglib.a libgfortran.a etc.. v

Re: String Metaprogramming

2015-07-18 Thread anonymous via Digitalmars-d-learn
On Saturday, 18 July 2015 at 16:18:30 UTC, Clayton wrote: Thanks , you were right . It seems there are some key words though which one has to use so that the code gets executed on compile-time .For example I had to change the second forloop to a foreach loop, `for` loops work just fine in CTF

Re: String Metaprogramming

2015-07-18 Thread Tamas via Digitalmars-d-learn
Thanks Nicholas , I have integrated some of your advice on the edited code i.e. foreach and ref in pattern . Hope I fully understood what you meant. Am yet to look whether I still need to change the signature . I have heared there are two approaches to this, Where does one really draw the lin

Re: String Metaprogramming

2015-07-18 Thread Clayton via Digitalmars-d-learn
On Saturday, 18 July 2015 at 16:01:25 UTC, Nicholas Wilson wrote: On Saturday, 18 July 2015 at 13:48:20 UTC, Clayton wrote: [...] [...] change function signature to int[char] function(string) or as the char type is the index probably better of as int[256] function(string). also probably n

Re: String Metaprogramming

2015-07-18 Thread Clayton via Digitalmars-d-learn
On Saturday, 18 July 2015 at 13:56:36 UTC, Adam D. Ruppe wrote: On Saturday, 18 July 2015 at 13:48:20 UTC, Clayton wrote: There seems to be a lot of mutation happening here yet I have heard no mutation should take place in meta-programming as it subscribes to functional programming paradigm.

Re: Working functionally with third party libraries

2015-07-18 Thread Kagamin via Digitalmars-d-learn
On Saturday, 18 July 2015 at 09:33:37 UTC, Jarl André Hübenthal wrote: I don't understand where you are going with this. I have solved my problem. Laziness is good for lets say take 5 out of infinite results. It's also good for saving resources, you don't spend time managing those resources a

Re: Does shared prevent compiler reordering?

2015-07-18 Thread Kagamin via Digitalmars-d-learn
No, it doesn't affect code generation, it's mostly for type checker to help write concurrent code, not to do it instead of you.

Re: String Metaprogramming

2015-07-18 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 18 July 2015 at 13:48:20 UTC, Clayton wrote: Am new to D programming, am considering it since it supports compile-time function execution . My challenge is how can I re-implement the function below so that it is fully executed in compile-time. The function should result to tabel1 b

Does shared prevent compiler reordering?

2015-07-18 Thread rsw0x via Digitalmars-d-learn
I can't find anything on this in the spec.

Sending an immutable object to a thread

2015-07-18 Thread Frank Pagliughi via Digitalmars-d-learn
Hey All, I'm trying to send immutable class objects to a thread, and am having trouble if the object is one of several variables sent to the thread. For example, I have a "Message" class: class Message { ... } and I create an immutable object from it, and send it to another thread:

Re: Virtual value types during compile-time for static type safety, static optimizations and function overloading.

2015-07-18 Thread Tamas via Digitalmars-d-learn
On Saturday, 18 July 2015 at 13:16:26 UTC, Adam D. Ruppe wrote: On Saturday, 18 July 2015 at 10:06:07 UTC, Tamas wrote: Compile & execute: $ dmd positive0.d; ./positive0; echo $? $ ldc2 positive0.d; ./positive0; echo $? Try adding the automatic optimize flags in all your cases. For dmd, `-O -

Re: String Metaprogramming

2015-07-18 Thread E.S. Quinn via Digitalmars-d-learn
On Saturday, 18 July 2015 at 13:48:20 UTC, Clayton wrote: Am new to D programming, am considering it since it supports compile-time function execution . My challenge is how can I re-implement the function below so that it is fully executed in compile-time. The function should result to tabel1 b

Re: String Metaprogramming

2015-07-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 18 July 2015 at 13:48:20 UTC, Clayton wrote: There seems to be a lot of mutation happening here yet I have heard no mutation should take place in meta-programming as it subscribes to functional programming paradigm. That's not true in D, you can just write a regular function and

String Metaprogramming

2015-07-18 Thread Clayton via Digitalmars-d-learn
Am new to D programming, am considering it since it supports compile-time function execution . My challenge is how can I re-implement the function below so that it is fully executed in compile-time. The function should result to tabel1 being computed at compile-time. There seems to be a lot of

Re: Virtual value types during compile-time for static type safety, static optimizations and function overloading.

2015-07-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 18 July 2015 at 10:06:07 UTC, Tamas wrote: Compile & execute: $ dmd positive0.d; ./positive0; echo $? $ ldc2 positive0.d; ./positive0; echo $? Try adding the automatic optimize flags in all your cases. For dmd, `-O -inline`. Not sure about ldc but I think it is `-O` as well.

VisualD building with GDC setting library path

2015-07-18 Thread kerdemdemir via Digitalmars-d-learn
Hi, I am tring to build Cristi Cobzarenco's fork of Scid which has LAPACK,BLAS dependency. I add all modules of Scid to my project and I am tring to build it within my project. I add LibraryFiles: liblapack.a libblas.a libtmglib.a libgfortran.a etc.. via menu configuration properties-->Lin

Re: Virtual value types during compile-time for static type safety, static optimizations and function overloading.

2015-07-18 Thread Tamas via Digitalmars-d-learn
Sorry, the main function of positive0.d correctly looks like this: int main() { return !((abs(-16) == 16) && (abs(3) == 3) && (square(5).absPositive == 25) && (square(-4).absPositive == 16)); } But this does not affect the results, the asm file sizs or the asm abs function bodies.

Re: Virtual value types during compile-time for static type safety, static optimizations and function overloading.

2015-07-18 Thread Tamas via Digitalmars-d-learn
I made a thorough comparison using multiple compilers and a summary of the findings. In short, there is a runtime overhead. I reduced the code to cut out the imports and made two versions with equivalent semantic content. positive0.d contains the hand written specializations of the abs functio

Re: Working functionally with third party libraries

2015-07-18 Thread via Digitalmars-d-learn
On Saturday, 18 July 2015 at 09:18:14 UTC, Kagamin wrote: On Saturday, 18 July 2015 at 08:03:56 UTC, Jarl André Hübenthal wrote: Its simple. In most cases you do an advanced aggregated search in mongo, and what you get is then a mongocursor. Lets say I am retrieving all projects for a given cus

Re: Working functionally with third party libraries

2015-07-18 Thread Kagamin via Digitalmars-d-learn
On Saturday, 18 July 2015 at 08:03:56 UTC, Jarl André Hübenthal wrote: Its simple. In most cases you do an advanced aggregated search in mongo, and what you get is then a mongocursor. Lets say I am retrieving all projects for a given customer where the project is started.. I really am in no int

Re: Working functionally with third party libraries

2015-07-18 Thread via Digitalmars-d-learn
On Friday, 17 July 2015 at 12:59:24 UTC, Kagamin wrote: On Friday, 17 July 2015 at 09:07:29 UTC, Jarl André Hübenthal wrote: Or loop it. But its pretty nice to know that there is laziness in D, but when I query mongo I expect all docs to be retrieved, since there are no paging in the underlying