Re: overring binary

2017-04-07 Thread rikki cattermole via Digitalmars-d-learn
On 08/04/2017 7:46 AM, Jethro wrote: I have a custom type and I'm trying to do things like x~1 and 1~x. I can get x~1 no problem by overriding the op "~" but how to I get 1~x to convert 1 in to typeof(x)? instead of x in to typeof(1) so to speak? I really want D to realize that 1~x is suppose

overring binary

2017-04-07 Thread Jethro via Digitalmars-d-learn
I have a custom type and I'm trying to do things like x~1 and 1~x. I can get x~1 no problem by overriding the op "~" but how to I get 1~x to convert 1 in to typeof(x)? instead of x in to typeof(1) so to speak? I really want D to realize that 1~x is suppose to use ~ of x, not 1.

Re: Creating Tuple or AliasSeq

2017-04-07 Thread Graham Fawcett via Digitalmars-d-learn
On Friday, 7 April 2017 at 10:26:24 UTC, ANtlord wrote: On Friday, 7 April 2017 at 07:46:40 UTC, Ali Çehreli wrote: [...] I can't understand. Documentation of cartesianProduct points out about finite arrays. At least one of arrays must be a inifinte array. As far as I know finite arrays is `

Re: Using template mixin, with or without mixin ?

2017-04-07 Thread Ali Çehreli via Digitalmars-d-learn
On 04/07/2017 04:47 PM, biocyberman wrote: I want to use mixin to generate function in-place. In template declaration, I can see 'mixin' keyword is optional. Is it true? What is the difference and when I must use one way over another? This is my program: // This works with and without 'mixin' a

Using template mixin, with or without mixin ?

2017-04-07 Thread biocyberman via Digitalmars-d-learn
I want to use mixin to generate function in-place. In template declaration, I can see 'mixin' keyword is optional. Is it true? What is the difference and when I must use one way over another? This is my program: // This works with and without 'mixin' attribute. mixin template funcgen(T, U){

Re: Is DMD breaking BigInt?

2017-04-07 Thread Meta via Digitalmars-d-learn
On Friday, 7 April 2017 at 17:06:31 UTC, Russel Winder wrote: Simple Dub build of a Factorial example using Unit-Threaded for testing. Works fine with ldc2 breaks with dmd. This is on Debian Sid fully up to date. |> ldc2 --version LDC - the LLVM D compiler (1.1.1):   based on DMD v2.071.2 and

Re: Function names and lambdas

2017-04-07 Thread Ali Çehreli via Digitalmars-d-learn
On 04/07/2017 11:19 AM, Yuxuan Shui wrote: > On Thursday, 6 April 2017 at 18:45:26 UTC, Ali Çehreli wrote: >> On 04/06/2017 11:37 AM, Russel Winder via Digitalmars-d-learn wrote: >>> [...] >> >> I think it's just a design choice. C implicitly converts the name of >> the function to a pointer to th

Re: Is DMD breaking BigInt?

2017-04-07 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 7 April 2017 at 17:06:31 UTC, Russel Winder wrote: If anyone has any useful intelligence as to what happening and how I can workaround it, I'd be a grateful bunny. You might want to check with LDC from Git master first to see whether it is in fact a 2.073-related problem. — David

Re: Is DMD breaking BigInt?

2017-04-07 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 7 April 2017 at 17:06:31 UTC, Russel Winder wrote: Simple Dub build of a Factorial example using Unit-Threaded for testing. Works fine with ldc2 breaks with dmd. Can you post the code your using?

Re: Function names and lambdas

2017-04-07 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 6 April 2017 at 18:45:26 UTC, Ali Çehreli wrote: On 04/06/2017 11:37 AM, Russel Winder via Digitalmars-d-learn wrote: [...] I think it's just a design choice. C implicitly converts the name of the function to a pointer to that function. D requires the explicit & operator: alia

Is DMD breaking BigInt?

2017-04-07 Thread Russel Winder via Digitalmars-d-learn
Simple Dub build of a Factorial example using Unit-Threaded for testing. Works fine with ldc2 breaks with dmd. This is on Debian Sid fully up to date.  |> ldc2 --version LDC - the LLVM D compiler (1.1.1):   based on DMD v2.071.2 and LLVM 3.9.1   built with LDC - the LLVM D compiler (1.1.0)   Defau

Re: Function names and lambdas

2017-04-07 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2017-04-06 at 11:45 -0700, Ali Çehreli via Digitalmars-d-learn wrote: > […] > I think it's just a design choice. C implicitly converts the name of > the  > function to a pointer to that function. D requires the explicit & > operator: One of the dangers of being a bit like and a replacemen

Re: is char[] faster than string?

2017-04-07 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 5 April 2017 at 22:05:07 UTC, H. S. Teoh wrote: If you are doing lots of concatenation and produce a single big string at the end, take a look at std.array.appender. Though if you're concerned about performance, you really should run a profiler. Last I heard, appender may not be

Re: Creating Tuple or AliasSeq

2017-04-07 Thread ANtlord via Digitalmars-d-learn
On Friday, 7 April 2017 at 07:46:40 UTC, Ali Çehreli wrote: Here is a solution: auto objectFactory(ObjectType, Args...)(Args args) { import std.algorithm : cartesianProduct, map; import std.array : array; return cartesianProduct(args).map!(a => ObjectType(a.expand)).array; } str

Re: Function names and lambdas

2017-04-07 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2017-04-06 at 18:45 +, Adam D. Ruppe via Digitalmars-d- learn wrote: > On Thursday, 6 April 2017 at 18:37:51 UTC, Russel Winder wrote: > > I am used to a function name being a reference to the function  > > body, cf. lots of other languages. However D rejects: > > > > iterative >

Re: Testing D codes

2017-04-07 Thread Kagamin via Digitalmars-d-learn
On Thursday, 6 April 2017 at 13:49:11 UTC, Russel Winder wrote: Is there any need for the unittest block in the application created to run the integration tests? If you don't care to call each and all of them by hand. Test frameworks are handy for extensive testing, builtin unittests work bes

Re: Creating Tuple or AliasSeq

2017-04-07 Thread ANtlord via Digitalmars-d-learn
On Friday, 7 April 2017 at 07:46:40 UTC, Ali Çehreli wrote: Here is a solution: auto objectFactory(ObjectType, Args...)(Args args) { import std.algorithm : cartesianProduct, map; import std.array : array; return cartesianProduct(args).map!(a => ObjectType(a.expand)).array; } str

Re: Testing D codes

2017-04-07 Thread drug via Digitalmars-d-learn
06.04.2017 19:34, Russel Winder via Digitalmars-d-learn пишет: I am still wondering about separating integration and system tests out of the module source leaving the unit tests in the module source. I do this. I have unittests in the module sources and have a separate subpackage intended for

Re: Creating Tuple or AliasSeq

2017-04-07 Thread Ali Çehreli via Digitalmars-d-learn
On 04/06/2017 10:43 PM, ANtlord wrote: Hello! I've got an issue related to making a Tuple or AliasSeq using income template arguments. I want to create template makes an array of objects from array of arrays have different sizes and different types of values. Here is a solution: auto objectFac

Re: Single exe vibe.d app

2017-04-07 Thread rikki cattermole via Digitalmars-d-learn
I'm going to give you a very bad but still a good place to begin with explanation. So, what is an executable? Well in modern operating systems that is a file with a very complex structure inside, like PE-COFF or ELF. It has a bunch of things as part of this, a dynamic relocation table, section

Re: Single exe vibe.d app

2017-04-07 Thread Suliman via Digitalmars-d-learn
On Thursday, 6 April 2017 at 17:39:15 UTC, Stefan Koch wrote: On Wednesday, 5 April 2017 at 12:13:38 UTC, Satoshi wrote: Hi, How can I build single exe application with vibe.d (windows)? now it require zlib.dll, libeay32.dll and ssleay32.dll But I need it as single app. One solution would be