Fluent APIs

Russel Winder via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 20 22:18:33 PDT 2017


I am having a crisis of confidence. In two places I have structurally:

    datum.action()
      .map!(…)

and then the fun starts as I need to actually do a flatMap. In one of
the two places I have to:

    .array
    .joiner;

but in the other place I have to:

    .joiner
    .array;

in order to stop the compiler spewing out a mass of (to me anyway)
incomprehensible messages with types I have no knowledge of. So why
does the fluent API chain break in different ways in the two cases. A
Priori this seems like a breakage of the abstraction.

Full code is at
https://github.com/russel/ApproxGC/blob/master/source/main.d
The comparison is between the functions createGenerationsDeleteList and
createListOfPlaces.

Any help rebuilding my knowledge would be good.

Also error message comprehensible to programmers rather than compiler
writers  might help.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20170521/9d2dea63/attachment.sig>


More information about the Digitalmars-d-learn mailing list