Re: merging map/filter/reduce/... in D

2016-01-28 Thread Ivan Kazmenko via Digitalmars-d-learn
On Friday, 29 January 2016 at 07:17:04 UTC, glathoud wrote: I have the impression that function implementations are not merged: return fun0(fun1(a)); For example, fun1(a) outputs a temporary array, which is then used as input for fun0. Merging the implementations of fun0 and fun1 would e

merging map/filter/reduce/... in D

2016-01-28 Thread glathoud via Digitalmars-d-learn
Hello, I am a D beginner, please excuse me if these questions are irrelevant. I had a look at this post: http://forum.dlang.org/post/aarldotsgluwdgtee...@forum.dlang.org Looking at the source code of compose!: https://github.com/D-Programming-Language/phobos/blob/v2.070.0/std/functional.d#L88

Re: Digger 2.4 & DMD 2.070.0

2016-01-28 Thread Sam Sellars via Digitalmars-d-learn
On Thursday, 28 January 2016 at 19:31:39 UTC, Marc Schütz wrote: On Thursday, 28 January 2016 at 07:45:01 UTC, Robert M. Münch wrote: Just compiled the latest release with digger. Everything works without any problems, but the resulting binary shows the following version: mac-pro:Digger robby

Re: What is the best declaration type for a string like parameter?

2016-01-28 Thread Puming via Digitalmars-d-learn
On Thursday, 28 January 2016 at 15:10:38 UTC, Adam D. Ruppe wrote: But for just both string and char[], yeah, const is the way to do it. [...] Thanks for the clear explaination. So `in char[]` is stricter (and safer) than `const(char)[]`. I will stick to that.

Re: What is the best declaration type for a string like parameter?

2016-01-28 Thread Puming via Digitalmars-d-learn
On Thursday, 28 January 2016 at 15:03:38 UTC, sigod wrote: On Thursday, 28 January 2016 at 13:36:46 UTC, Puming wrote: [...] `in char[]` is short for `scope const char[]` or `scope const(char[])`. See http://dlang.org/spec/function.html#parameters It depends on the situation. If possible I

Re: Can D interface with Free Pascal?

2016-01-28 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 28 January 2016 at 19:49:22 UTC, Taylor Hillegeist wrote: On Thursday, 28 January 2016 at 19:33:22 UTC, bearophile wrote: FreeSlave: On Thursday, 28 January 2016 at 08:15:38 UTC, FreeSlave wrote: Not directly. You can declare cdecl function on Free Pascal side and call it as exter

Re: how to allocate class without gc?

2016-01-28 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 27 January 2016 at 22:39:54 UTC, Igor wrote: But doesn't this ultimately defeat the purpose of having manual memory management if one has to add it to the GC to be scanned? You can make the LOC related to the GC optional with an additional bool template parameter and a static if,

Re: What is the best declaration type for a string like parameter?

2016-01-28 Thread tsbockman via Digitalmars-d-learn
On Thursday, 28 January 2016 at 17:32:31 UTC, Gary Willoughby wrote: On Thursday, 28 January 2016 at 15:10:38 UTC, Adam D. Ruppe wrote: On Thursday, 28 January 2016 at 13:36:46 UTC, Puming wrote: I searched the forum and found that people use `const(char)[]` or `in char[]` to accept both string

Re: Can D interface with Free Pascal?

2016-01-28 Thread Taylor Hillegeist via Digitalmars-d-learn
On Thursday, 28 January 2016 at 19:33:22 UTC, bearophile wrote: FreeSlave: On Thursday, 28 January 2016 at 08:15:38 UTC, FreeSlave wrote: Not directly. You can declare cdecl function on Free Pascal side and call it as extern(C). What about extern(Pascal)? https://dlang.org/spec/attribute.html

Re: Digger 2.4 & DMD 2.070.0

2016-01-28 Thread Marc Schütz via Digitalmars-d-learn
On Thursday, 28 January 2016 at 07:45:01 UTC, Robert M. Münch wrote: Just compiled the latest release with digger. Everything works without any problems, but the resulting binary shows the following version: mac-pro:Digger robby$ ./result/bin/dmd --version DMD64 D Compiler v2.069-devel-682687b

Re: Can D interface with Free Pascal?

2016-01-28 Thread bearophile via Digitalmars-d-learn
FreeSlave: On Thursday, 28 January 2016 at 08:15:38 UTC, FreeSlave wrote: Not directly. You can declare cdecl function on Free Pascal side and call it as extern(C). What about extern(Pascal)? https://dlang.org/spec/attribute.html#linkage Bye, bearophile

Re: Assert failure on 2.070.0 without stack trace

2016-01-28 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 28 January 2016 at 18:13:59 UTC, Vladimir Panteleev wrote: You can use Digger to find the exact compiler change that caused this assert to manifest, and Dustmite to find the minimal program which behaves differently in two compiler versions. Thanks, I'm aware of these tools. But

Re: Assert failure on 2.070.0 without stack trace

2016-01-28 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 28 January 2016 at 18:13:59 UTC, Vladimir Panteleev wrote: On Thursday, 28 January 2016 at 18:01:09 UTC, Nordlöw wrote: After upgrading to 2.070.0 I get an assert failure in my application that wasn't there before: core.exception.AssertError@knet/linking.d(235): Assertion failure

Re: Assert failure on 2.070.0 without stack trace

2016-01-28 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 28 January 2016 at 18:01:09 UTC, Nordlöw wrote: After upgrading to 2.070.0 I get an assert failure in my application that wasn't there before: core.exception.AssertError@knet/linking.d(235): Assertion failure Why isn't there any stacktrace? I thought has been fixed. Please help

Assert failure on 2.070.0 without stack trace

2016-01-28 Thread Nordlöw via Digitalmars-d-learn
After upgrading to 2.070.0 I get an assert failure in my application that wasn't there before: core.exception.AssertError@knet/linking.d(235): Assertion failure Why isn't there any stacktrace? I thought has been fixed. Please help.

Re: What is the best declaration type for a string like parameter?

2016-01-28 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 28 January 2016 at 15:10:38 UTC, Adam D. Ruppe wrote: On Thursday, 28 January 2016 at 13:36:46 UTC, Puming wrote: I searched the forum and found that people use `const(char)[]` or `in char[]` to accept both string and char[] arguments. There's also the hyper-generic signatures Pho

Re: Getting the body of a HTTP Request

2016-01-28 Thread yawniek via Digitalmars-d-learn
On Wednesday, 27 January 2016 at 23:42:54 UTC, brian wrote: Anyone able to shed some light on what the structure of the response is, and how I can read/output it all? Regards Brian its unlikely that vibe client misses something. for debugging i would try to go trough all requests with curl on

Re: Make function nothrow

2016-01-28 Thread ref2401 via Digitalmars-d-learn
On Thursday, 28 January 2016 at 16:22:23 UTC, Ali Çehreli wrote: There is assumeWontThrow which terminates if an exception is indeed thrown: http://dlang.org/library/std/exception/assume_wont_throw.html Ali nice one, thx

Can't run unit tests on Win7 64-bit?

2016-01-28 Thread pineapple via Digitalmars-d-learn
I have a super simple D file that looks like this: unittest{ import std.stdio; writeln("hello"); } On OSX Mavericks I run "rdmd --main -unittest test.d" and I get a nice "hello" and everything is well. On Win7 64-bit I run "> rdmd --main -unittest test.d" and rdmd seems to hang. It n

Re: Make function nothrow

2016-01-28 Thread Ali Çehreli via Digitalmars-d-learn
On 01/28/2016 08:05 AM, ref2401 wrote: There are functions in Phobos that do not throw but they are not marked as `nothrow`. When I need to call them from my `nothrow` code I do this: void foo() { /* I won't throw, honestly. */ } void bar() nothrow { scope(failure) assert(false); foo(

Re: foreach change for multi-dimensional data

2016-01-28 Thread ixid via Digitalmars-d-learn
On Thursday, 28 January 2016 at 15:38:20 UTC, Ali Çehreli wrote: On 01/28/2016 05:33 AM, ixid wrote: > This is an idle thought hence putting it on the Learn-level forum. An > idea struck me for foreach to make working with more complicated data > types or heavily nested data easier. > > > ui

Make function nothrow

2016-01-28 Thread ref2401 via Digitalmars-d-learn
There are functions in Phobos that do not throw but they are not marked as `nothrow`. When I need to call them from my `nothrow` code I do this: void foo() { /* I won't throw, honestly. */ } void bar() nothrow { scope(failure) assert(false); foo(); } The question is: Is it ok t

Re: foreach change for multi-dimensional data

2016-01-28 Thread Ali Çehreli via Digitalmars-d-learn
On 01/28/2016 05:33 AM, ixid wrote: > This is an idle thought hence putting it on the Learn-level forum. An > idea struck me for foreach to make working with more complicated data > types or heavily nested data easier. > > > uint[][] a = [[1,2,3],[4,5,6]]; [...] > It would be nice if you co

Re: What is the best declaration type for a string like parameter?

2016-01-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 28 January 2016 at 13:36:46 UTC, Puming wrote: I searched the forum and found that people use `const(char)[]` or `in char[]` to accept both string and char[] arguments. There's also the hyper-generic signatures Phobos uses like void foo(S)(S s) if(isSomeString!S) and the input ra

Re: What is the best declaration type for a string like parameter?

2016-01-28 Thread sigod via Digitalmars-d-learn
On Thursday, 28 January 2016 at 13:36:46 UTC, Puming wrote: I have a function that reads a line of string and do some computation. I searched the forum and found that people use `const(char)[]` or `in char[]` to accept both string and char[] arguments. What's the difference between `const(c

Re: Non-English characters in code - "character 0x2212 is not a valid token"

2016-01-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 28 January 2016 at 14:39:46 UTC, sigod wrote: I tried to compile your code on dpaste (2.070.0) and got this: dpaste has an input mangling bug with some characters as a result of the form submission over the web.

Re: Non-English characters in code - "character 0x2212 is not a valid token"

2016-01-28 Thread sigod via Digitalmars-d-learn
On Thursday, 28 January 2016 at 13:26:27 UTC, Andrea Fontana wrote: On Thursday, 28 January 2016 at 13:18:55 UTC, pineapple wrote: I experimented with using the character 'ħ' in a variable name, and wasn't terribly surprised when the compiler didn't like it. What did surprise me is that I still

What is the best declaration type for a string like parameter?

2016-01-28 Thread Puming via Digitalmars-d-learn
I have a function that reads a line of string and do some computation. I searched the forum and found that people use `const(char)[]` or `in char[]` to accept both string and char[] arguments. What's the difference between `const(char)[]` and `in char[]`? If they are not the same, then whic

foreach change for multi-dimensional data

2016-01-28 Thread ixid via Digitalmars-d-learn
This is an idle thought hence putting it on the Learn-level forum. An idea struck me for foreach to make working with more complicated data types or heavily nested data easier. uint[][] a = [[1,2,3],[4,5,6]]; foreach(uint[] b; a) b.writeln; At present

Re: Non-English characters in code - "character 0x2212 is not a valid token"

2016-01-28 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 28 January 2016 at 13:18:55 UTC, pineapple wrote: I experimented with using the character 'ħ' in a variable name, and wasn't terribly surprised when the compiler didn't like it. What did surprise me is that I still got a compile error even when the character was in a comment. Is th

Re: Non-English characters in code - "character 0x2212 is not a valid token"

2016-01-28 Thread pineapple via Digitalmars-d-learn
On Thursday, 28 January 2016 at 13:18:55 UTC, pineapple wrote: I experimented with using the character 'ħ' in a variable name, and wasn't terribly surprised when the compiler didn't like it. What did surprise me is that I still got a compile error even when the character was in a comment. Is th

Non-English characters in code - "character 0x2212 is not a valid token"

2016-01-28 Thread pineapple via Digitalmars-d-learn
I experimented with using the character 'ħ' in a variable name, and wasn't terribly surprised when the compiler didn't like it. What did surprise me is that I still got a compile error even when the character was in a comment. Is there any way to make dmd not get fussy about unicode?

Re: how to allocate class without gc?

2016-01-28 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 27 January 2016 at 22:39:54 UTC, Igor wrote: Ultimately I want no GC dependency. Is there an article that shows how this can be done? You can link with gcstub https://github.com/D-Programming-Language/druntime/blob/master/src/gcstub/gc.d it will replace GC completely.

Re: Can D interface with Free Pascal?

2016-01-28 Thread FreeSlave via Digitalmars-d-learn
On Thursday, 28 January 2016 at 04:26:26 UTC, Taylor Hillegeist wrote: Just curious... I had a thought that perhaps since Objective C was a replacement for Pascal on the mac. that they might have the same interface. but I'm not savvy enough with fpc to figure out how to try it. Not directly.

Re: core.sys.posix.sys.ioctl

2016-01-28 Thread tsbockman via Digitalmars-d-learn
On Thursday, 28 January 2016 at 06:15:54 UTC, sanjayss wrote: So I got round to doing this -- https://github.com/D-Programming-Language/druntime/pull/1485 -- it's not clear what happens now -- is there a set of people that reviews pull requests and comment on it or is it open to all? I shoul