C++ UFCS update
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Sun Feb 21 02:45:50 PST 2016
On Sunday, 21 February 2016 at 10:16:19 UTC, Jonathan M Davis
wrote:
> As for a pipe operator, I expect that it wouldn't really help
> any. It would be a lot like . vs -> in that it's an unnecessary
> complication,
"." vs "->" isn't an unnecessary complication it is a strong
typing issue, as can be seen when trying to implement a smart
pointer.
> but it would actually probably be worse. If | meant that a
> function call could be either a member function or a free
> function, you'd still have no more clue about which functions
> were member functions than you do now,
There are many options.
It could require function objects (instantiated or
non-instantiated) that provide the right opXXX members. If the
protocol is well designed and fully specified then the compiler
can figure out what glue-code to generate even if connecting
nodes aren't directly compatible, or choose the most efficient
interface (e.g. one node provides a SIMD interface)
If iterators (ranges) are a main selling point for D, then you
might as well give pipelining language support, make it better
than a library solution, open up for parallel execution and
hardware dependent cache and loop optimizations. A pure library
solution cannot do this well.
> the syntax. So, I really don't see how another syntax would
> help any.
Stronger typing helps when programs grow in size...
More information about the Digitalmars-d
mailing list