RejectedSoftware Forums

Sign up

sample from dconf does not work with dub

I have problem with following code (DConf 2013 Day 1 Talk 1: Opening Keynote by Walter Bright):

import std.stdio, std.array, std.algorithm;

void main( ) {
    stdin.byLine(KeepTerminator.yes).
    map!(a => a.idup).
        array.sort.copy(stdout.lockingTextWriter());
}

it works fine without dub, but it fails with dub:

Building configuration "application", build type debug
Running dmd (compile)...
source/app.d(4): Error: no property 'map' for type 'ByLine!(char, char)'
Error: Build command failed with exit code 1

My package.json is

{
        "name": "tmp",
        "description": "An example project skeleton",
        "homepage": "http://example.org",
        "copyright": "Copyright © 2000, Your Name",
        "authors": [
                "Your Name"
        ],
   "versions": ["VibeCustomMain"],

        "dependencies": {

        }
}

Please advice

Re: sample from dconf does not work with dub

On Sat, 11 May 2013 14:16:38 GMT, sibnick wrote:

I have problem with following code (DConf 2013 Day 1 Talk 1: Opening Keynote by Walter Bright):
(...)

DUB by default adds the "-property" switch to the DMD command line, which enforces parentheses on non-property function calls, so array, sort and map need empty parentheses, even if they are invoked with uniform function call syntax. So the solution is to either change the code to map!(a => a.idup)().array().sort().copy(stdout.lockingTextWriter()), or to add an entry to package.json to disable the property switch: "buildRequirements": ["relaxProperties"]

Hopefully D's properties will be improved a bit in the forseeable future and this will become a non-issue. There have been several proposals recently and although the discussion got stuck at some point, there is hope that one of them gets accepted at some point: DIP21, DIP24, DIP26, DIP28

Re: sample from dconf does not work with dub

Thanks a lot for complete answer!