More radical ideas about gc and reference counting

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Mon May 5 10:27:16 PDT 2014


Am Mon, 5 May 2014 09:39:30 -0700
schrieb "H. S. Teoh via Digitalmars-d"
<digitalmars-d at puremagic.com>:

> On Mon, May 05, 2014 at 03:55:12PM +0000, bearophile via Digitalmars-d wrote:
> > Andrei Alexandrescu:
> > 
> > >I think the "needs to support BigInt" argument is not a blocker - we
> > >can release std.rational to only support built-in integers, and then
> > >adjust things later to expand support while keeping backward
> > >compatibility. I do think it's important that BigInt supports
> > >appropriate traits to be recognized as an integral-like type.
> > 
> > Bigints support is necessary for usable rationals, but I agree this
> > can't block their introduction in Phobos if the API is good and
> > adaptable to the successive support of bigints.
> 
> Yeah, rationals without bigints will overflow very easily, causing many
> usability problems in user code.
> 
> 
> > >If you, Joseph, or both would want to put std.rational again through
> > >the review process I think it should get a fair shake. I do agree
> > >that a lot of persistence is needed.
> > 
> > Rationals are rather basic (important) things, so a little of
> > persistence is well spent here :-)
> [...]
> 
> I agree, and support pushing std.rational through the queue. So, please
> don't give up, we need it get it in somehow. :)
> 
> 
> T

That experimental package idea that was discussed months ago
comes to my mind again. Add that thing as exp.rational and
have people report bugs or shortcomings to the original
author. When it seems to be usable by everyone interested it
can move into Phobos proper after the formal review (that
includes code style checks, unit tests etc. that mere users
don't take as seriously).

As long as there is nothing even semi-official, it is tempting
to write such a module from scratch in a quick&dirty fashion
and ignore existing work.
The experimental package makes it clear that this code is
eventually going to the the official way and home brewed stuff
wont have a future. Something in the standard library is much
less likely to be reinvented. On the other hand, once a module
is in Phobos proper, it is close to impossible to change the
API to accommodate for a new use case. That's why I think the
most focused library testing and development can happen in the
experimental phase of a module. The longer it is, the more
people will have tried it in their projects before formal
review, which would greatly improve informed decisions.
The original std.rationale proposal could have been in active
use now for months!

-- 
Marco



More information about the Digitalmars-d mailing list