Skip to content

Add package.d files under core#23116

Open
nordlow wants to merge 1 commit into
dlang:masterfrom
nordlow:core-packages
Open

Add package.d files under core#23116
nordlow wants to merge 1 commit into
dlang:masterfrom
nordlow:core-packages

Conversation

@nordlow
Copy link
Copy Markdown
Contributor

@nordlow nordlow commented May 10, 2026

For the sake of being able to do, for instance,

import core.stdc;

in ImportC.

Shall I go forward with core.sys aswell?

@nordlow
Copy link
Copy Markdown
Contributor Author

nordlow commented May 10, 2026

Why this mak/COPY? Why not just copy everything using a wildcard?!

@thewilsonator thewilsonator added the Druntime Specific to druntime label May 11, 2026
@nordlow
Copy link
Copy Markdown
Contributor Author

nordlow commented May 14, 2026

Ping.

@dkorpel
Copy link
Copy Markdown
Contributor

dkorpel commented May 14, 2026

IIRC Walter was against doing this, I'll ask him again.

Either way this needs a good justification. What real world code would benefit from this?

For the sake of being able to do, for instance,

import core.stdc;

in ImportC.

import core.stdc is D, not C or ImportC.

@nordlow
Copy link
Copy Markdown
Contributor Author

nordlow commented May 14, 2026

Just a way for people to more easily make use of all C library standard functions like printf() when using BetterC. So in that case it would suffice to just add the public imports to core.stdc. I'm not sure about core.stdcpp in this regard.

@WalterBright
Copy link
Copy Markdown
Member

WalterBright commented May 15, 2026

Thanks @nordlow for taking the time to do this.

But I have to say, this encourages sloppy programming, and just rubs me the wrong way. In my code, anyway, both C and D, I have no need for most of stdc.

@nordlow
Copy link
Copy Markdown
Contributor Author

nordlow commented May 16, 2026

But I have to say, this encourages sloppy programming

How is this sloppier than already allowed import std?

Thanks @nordlow for taking the time to do this.

But I have to say, this encourages sloppy programming, and just rubs me the wrong way. In my code, anyway, both C and D, I have no need for most of stdc.

The most important addition here core/std/package.d. Enabling

import core.stdc;

in BetterC is IMO a very useful thing.

@nordlow
Copy link
Copy Markdown
Contributor Author

nordlow commented May 24, 2026

Ping.

@nordlow
Copy link
Copy Markdown
Contributor Author

nordlow commented May 24, 2026

import core.stdc is D, not C or ImportC.

I don't understand this statement. The whole purpose of this PR is to have people skilled in C just be able to use most of the common C functions without having to care about in which include/import they reside.

@dkorpel
Copy link
Copy Markdown
Contributor

dkorpel commented May 24, 2026

I don't understand this statement.

You said:

For the sake of being able to do, for instance,

import core.stdc;

in ImportC.

ImportC is dmd's C compiler. Try creating a .c file with that line in it and compile it with dmd. You will get a syntax error.

How is this sloppier than already allowed import std?

Walter has been against that as well.

The whole purpose of this PR is to have people skilled in C just be able to use most of the common C functions without having to care about in which include/import they reside.

Anyone can write their own utility module which publicly imports all their favorite (C) functions. But for adding features upstream, there's a high bar. You need to show that this feature is pulling its weight, "it might be useful" is not strong enough.

@nordlow
Copy link
Copy Markdown
Contributor Author

nordlow commented May 24, 2026

Ahh, sorry. I meant BetterC usage.

@dkorpel
Copy link
Copy Markdown
Contributor

dkorpel commented May 24, 2026

Ahh, sorry. I meant BetterC usage.

Even then, it's very easy to translate

#include <stdio.h>
#include <stdlib.h>

To

import core.stdc.stdio;
import core.stdc.stdlib;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Druntime Specific to druntime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants