Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRFC: Allow a re-export for `main` #1260
Conversation
This comment has been minimized.
This comment has been minimized.
|
As requested by @steveklabnik in rust-lang/rust#27640 (comment). |
tbu-
force-pushed the
tbu-:rfc_main_reexport
branch
from
bb665a8
to
d41ee16
Aug 19, 2015
This comment has been minimized.
This comment has been minimized.
|
I think that this RFC probably wants to be expanded at least a little bit more, for example it may wish to consider the |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton Nothing really changes, everything behaves as would be consistent with other behavior: Re-exports behave the same as if the function was declared in that place. To expand on that: The attribute Can you clarify what you think is missing? |
nrc
added
the
T-lang
label
Aug 20, 2015
This comment has been minimized.
This comment has been minimized.
|
@tbu- there are no concrete examples given in the RFC. The phrase " |
This comment has been minimized.
This comment has been minimized.
|
(the RFC text probably would also have benefited from referencing the rust-lang/rust#27640 ) |
This comment has been minimized.
This comment has been minimized.
|
I agree with @pnkfelix that a bit more detail would be nice -- I found it a bit hard to figure out what this RFC was even requesting. IIUC, this RFC is basically saying "you should be able to do Do you have an implementation of this? Or was it merely that you opened an issue because it seemed surprising and wrong, but didn't actually plan to fix it in the short term? (I have no objection to the latter, to be clear, just want to understand the state here.) I'm trying to imagine what complications might arise from being more general? I don't know enough about linkers etc to know if there is somehow a problem where ultimately the compiler would have to synthesize the main function you didn't write? For example, if an UPDATE: tweaked wording. |
tbu-
force-pushed the
tbu-:rfc_main_reexport
branch
3 times, most recently
from
9148a3b
to
89c91f6
Aug 21, 2015
tbu-
force-pushed the
tbu-:rfc_main_reexport
branch
from
89c91f6
to
2ac3284
Aug 21, 2015
This comment has been minimized.
This comment has been minimized.
|
+1. Seems completely reasonable. |
This comment has been minimized.
This comment has been minimized.
|
Forgot to click the 'comment' button: I'm sorry that I rushed this RFC in this way, updated it with examples and a link to the issue discussion, thanks for the hints. @steveklabnik I don't have an implementation of this, this was merely ment as a bug report, "it seemed surprising to me, I didn't plan to fix it in the sort term". I totally see why this is low-priority, because you can work around very easily and without much typing. |
nikomatsakis
assigned
pnkfelix
Sep 3, 2015
This comment has been minimized.
This comment has been minimized.
|
I was going to post something here about this potentially breaking certain workflows with debuggers (along the lines about whether one could assume that certain functions named But then while making a concrete example of the point, I realized that the @tbu- Here are some updates I suggest:
|
This comment has been minimized.
This comment has been minimized.
nikomatsakis
added
the
final-comment-period
label
Oct 2, 2015
This comment has been minimized.
This comment has been minimized.
|
Note: I'm still not sure why this even warrants an RFC. Re-exports and functions do not behave differently in other places. |
This comment has been minimized.
This comment has been minimized.
|
@tbu- part of the reason for the RFC process is to vet changes to the language and have them go through a review process that is independent of the implementation of the change. I can understand your view that this perhaps could have been categorized as "just a bug" to be fixed, and not a "change to the language per se." But then again, the question about whether the re-exported In this case the change is relatively small and seems pretty straight-forward (in terms of its specification -- I am not considering difficulty of implementation here). I assume there won't be any hurdles for acceptance, assuming no one points out any critical flaws during the FCP. |
This comment has been minimized.
This comment has been minimized.
|
I'm confused, I thought Also doesn't main normally need to be public? |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
|
Wat. Why on earth do we allow that? Can't declare main to be static in C (https://goo.gl/L6D1gB). I think my first point still stands however: http://is.gd/8Vt2Cq. Now arguably there should be such a notion of a private re-export, so things like that can work, but as it stands the language doesn't have one. |
This comment has been minimized.
This comment has been minimized.
|
In my humble opinion non- So any private use would be a re-export for all module below it. (See also #1289) |
This comment has been minimized.
This comment has been minimized.
|
@Ericson2314 For what its worth, I meant to write "re-naming import" when I originally wrote "re-export." |
This comment has been minimized.
This comment has been minimized.
|
@pnkfelix ah, ok. @Kimundi, I was going to ask would this cause an explosion of extra symbols, but then I remembered (I think correctly) that items' names match the original location they are defined in, and that their aren't extra symbols for each re-export.
I see these options:
|
This comment has been minimized.
This comment has been minimized.
|
In the case of On Sun, Oct 4, 2015 at 12:11 PM, John Ericson notifications@github.com
|
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis You are correct that there is a generated stub ( The mangled name for a normal main is roughly tl;dr, generated name or no generated name, still worthwhile to think about symbol names. |
aturon
referenced this pull request
Oct 9, 2015
Open
Tracking issue for Allow a re-export for `main` (RFC 1260) #28937
This comment has been minimized.
This comment has been minimized.
|
This RFC has been merged. The lang team discussed this RFC, and while no one felt strongly that it was important to tackle, it's a relatively minor detail that we would accept a PR to change. |
aturon
removed
the
final-comment-period
label
Oct 9, 2015
This comment has been minimized.
This comment has been minimized.
|
It seems like this was not an actual merge? 411daab is the relevant commit. This PR should not be open anymore? |
aturon
merged commit aa533f9
into
rust-lang:master
Oct 13, 2015
This comment has been minimized.
This comment has been minimized.
|
@jethrogb Fixed, thanks. |
This comment has been minimized.
This comment has been minimized.
|
On Thu, Oct 08, 2015 at 07:34:54PM -0700, John Ericson wrote:
I think my point was us that the symbol name of interest is probably |
tbu- commentedAug 19, 2015
(rendered)