Any estimates on having exceptions in betterC?

Mike Franklin slavo5150 at yahoo.com
Fri May 3 13:30:01 UTC 2019


On Friday, 3 May 2019 at 11:34:11 UTC, Piotrek wrote:

> It would be good to synchronize all related work. If I 
> understood you correctly, Andrei statement means green light to 
> refinement of the D standard library in the spirit you were 
> advocating?

The only thing I know of that Andrei has green-lighted is 
converting runtime hooks to templates.  I think it's something 
he's been trying to get done for years.  The first PRs I saw for 
it were from Lucia Cojocaru.  She did the `__equals` and `__cmp` 
templates and gave a presentation for it at DConf 
(https://www.youtube.com/watch?v=endKC3fDxqs)

Since Lucia left, there hasn't really been anyone else working on 
it except me.  Unfortunately, I had a lot to learn and couldn't 
do anything until I figured a few things out.  I feel that I 
finally have a pretty good understanding of what to do and how, 
but I'm trying to clean up some unfinished business before I get 
back to it.  If you want to start working converting the 
remaining runtime hooks to templates, let me know and I'll share 
what I know.

The 2nd task that I think is important right now is to make a 
dependency-less utility library.  I have never discussed this 
with anyone except on the forum, so I don't know what Andrei or 
anyone else thinks of it.  I wish I had more of an opportunity to 
discuss things like this on a regular basis with other D 
developers, but I don't know how to facilitate that.

You can get a basic understanding of what needs to be done by 
looking at the following module pairs:
std.traits  core.internal.traits
std.conv    core.internal.convert
std.utf     core.internal.utf
{... there are others ...}
Next, see this discussion 
(https://forum.dlang.org/post/mailman.6241.1546722791.29801.digitalmars-d@puremagic.com) about creating a `core.traits` module to get a better perspective.

Do you see the redundancy?

What you'll likely notice is that there are many utilities in 
Phobos that could also be utilized to implement things in 
druntime, DMD, and bare-metal programs.  Candidates include 
`std.meta`, `std.traits`, `std.conv`, and many more.

Therefore, I propose pulling all of those useful utilities, that 
don't require druntime for their implementation, out of Phobos 
and into their own library that can be imported by druntime, DMD, 
and bare-metal projects.  I'm calling this library "utiliD".

The rules for this library are simple:
1.  No dependencies whatsoever.  No dependencies on C standard 
library, druntime, OS bindings, etc...
2.  No dynamic heap memory allocation.  Dynamic stack memory 
allocation is ok.

Finally, the 3rd thing I have in mind is to re-implement 
`memcpy`, `memcmp`, `malloc`, `free` and friends in D.  Here's a 
little exploration I did for `memcpy` 
(https://github.com/JinShil/memcpyD).  Note how it utilizes D's 
metaprogramming features.  I can elaborate further on this if 
you're interested.

GSoC proposals were submitted for the 1st and 3rd tasks.  
Accepted proposals are to be announced May 6th, so if you're 
interested in either one of them, you'll want to be sure not to 
duplicate or interfere with those tasks, should they be accepted.

That's where I'm at right now.  I don't know if that's of any use 
to you, but I'm here if you wish to discuss these topics or 
others further.  You can find me on Slack and Discord under the 
handle JinShil should you wish to have more of a dialog.

Mike





More information about the Digitalmars-d mailing list