On Thursday, 28 December 2017 at 03:31:19 UTC, ChangLong wrote:
On Wednesday, 27 December 2017 at 10:08:37 UTC, Walter Bright
wrote:
On 12/27/2017 12:59 AM, Dan Partelly wrote:
All could have been prevented by going the C++ route of 0
cost abstraction,
C++ is not 0 cost abstraction, despite the marketing. It's why
C++ compilers have switches to disable things like EH and RTTI.
Hi Walter, Can you take a look at this betterC bug:
https://issues.dlang.org/show_bug.cgi?id=18099
==========
struct D()
{
struct V {
~this() {
}
}
auto get() {
V v ;
return v ;
}
}
alias T = D!();
============
Error: Cannot use throw statements with -betterC
a.d(12): Error: template instance a.D!() error instantiating
It is a block for implement auto RefCount in betterC. Since
there is no GC, auto RefCount is the way to make D work far
more useable then pure C, and it relay on this bug to be fixed.
With BetterC and Auto RefCount, Simple template can simulation
Rust Box, Arc behavior.
I has try made a BetterC lib to work with libuv, Fiber(implement
by struct), Thread local storage(use libuv api with Thread in
struct). There is noGc and Boxed data auto release by auto
RefCount.
BetterC made D generate extreme fast and small binary execute
code. And the powerful template can easy simulation Rust Box and
Go Channel.
If I add a D version to made the code at single thread mode, the
speed is even more fast since the Channel lock and Tls is removed
without change code.
With D version Box template, Boxed struct resource are allocate
in a pool, and auto release into pool after the refCount to zero.
It make the code look like normal D Code without betterC, and
get the noGC benefit.
The defect is I can not use Class and Exception, It has be done
with a custom object.d.