-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal for Goals #51
Conversation
Move firebase support into a src directory. (#15)
Update fork
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments inline...
docs/project/goals.md
Outdated
unnecessarily complex code, and that is okay. We should instead focus on helping | ||
reduce the rate that this occurs accidentally, and enabling tooling and | ||
diagnostics that warn about dangerous or surprising patterns. This takes the | ||
language out of the business of legislating these types of issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There area subtlety that might be worth acknowledging here. To what extent does disallowing "bad" code patterns overlap with semantic restrictions designed to enable optimization or enable tooling to detect errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about rephrasing this as "The language should stay out of the business of legislating bad code patterns except where it affects detecting logic or performance errors."?
@chandlerc (FYI)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I lik ethe direction here, but I think it might require a bit more of a change. Fundamentally, I think the thing Hal is pointing out that erroneous patterns should still be in-scope to restrict. This section is talking about "bad" things that in some way aren't fundamentally errors, and that's the subtlety that I think Hal is driving at here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting: I'm not clear what kind of different wording you might be suggesting. It's been adjusted a little, and if you still have concerns, explicit suggestions may help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll suggest an update to this section that I think gets more deeply at the issue raised by Hal here.
docs/project/goals.md
Outdated
write it naturally in Carbon. | ||
|
||
**Possible to mechanically source-to-source migrate large segments of | ||
large-scale idiomatic C++ code bases with high fidelity.** We will prioritize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned that this goal seems at odds with the goals related to bounded-look-ahead parsing and simple name-lookup rules (which are very important goals). How would we migrate templates that "work" because of ADL or other aspects of C++ name-lookup rules? Do we have some idea that this is a very-small percentage of the overall code of interest? Is it not idiomatic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an aspect here that gets to the prioritization of language goals. Higher priorities may preempt if there are conflicts, or we may find more complex workarounds to make migration work, especially where it does not impact code outside of migration/interop code.
For the case of name lookups, I can imagine migration tooling identifying which C++ APIs a caller is using and, as those APIs are translated to Carbon (or vice-versa), inserts extra wrapper code if default name-lookup would yield a different API being called.
i.e., translating some C++ behavior may result in more complex Carbon code in order to achieve the same logic, possibly leaving it for humans to improve style later if so desired.
We do expect some code won't be possible to migrate automatically, which is where the 2% comes in (albeit as a somewhat arbitrary threshold). Minimally, I'd hope we can get warnings if migrated code should be expected to behave differently, although we probably won't be able to catch every case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, my stance is that code that happens to work via ADL is very likely non-idiomatic.
But I think there may also be some fallback translation options here, perhaps at a loss of readability.
I do agree that the ranking starts to show a bit of its importance here -- we shouldn't be complicating the name lookup rules just to make the automated translation somewhat cleaner unless this is a massive practical problem... Which I think is unlikely, but I suppose possible. I would at least want to have very clear evidence to support taking on the cost of more complexity in name lookup or similar.
docs/project/goals.md
Outdated
- PPC64LE (Power ISA, 64-bit, Little Endian) | ||
- RV64I (RISC-V 64-bit) | ||
|
||
We believe Carbon should strive to support some GPUs, other restricted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We say something here about GPUs, but we don't really say anything about parallelism in general.Talking about the ability to express parallelism, semantically, is perhaps even more important than GPUs in particular. We should aim to allow the expression, semantically, of computational patterns that naturally map onto common accelerator hardware. Then we'll need to decide how to express data movement and locality - work scheduling and placement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree parallelism should be addressed in some way, although I think the "Code should perform predictably" paragraph above may partly address your concern without addressing common accelerator hardware directly.
What about something like "Common yet complex tasks, e.g., parallel code, should be well-supported in ways that are easy to reason about.", under "Code that is easy to read, understand, and write"? (see changes) Do you have suggestions for other ways to phrase this? I do wonder if that section got a little too abstract in its phrasing.
@chandlerc (FYI)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I lean a bit more toward Hal's phrasing, but I'm not sure where to embed that within the document.
Does it make sense to try to add thsi clarity in a follow-up, or to do it here? If here, I'll try to think more precisely to make a constructive suggestion of where it might fit best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not call out specific software structures, because it seems like a slippery slope (e.g. why only parallelism, and not concurrency or asynchrony?). In any event, doesn't the goal of supporting performance-critical software imply support for parallelism?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The performance section doesn't really talk about hardware, and in large part because that's largely covered here.
I'd lean towards calling out the specific software structures that are necessary to program modern, major hardware. This, for example, would differ significantly from language that relies on compilation techniques to translate one programming model into another. Instead, I think this goal needs to anchor Carbon into fairly direct support for the necessary set of programming models to directly target the relevant hardware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spoke with Chandler about this, added paragraph mentioning SIMD (may be easiest to comment on the latest revision, may iterate too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really happy with the current state I think going into a decision. My comments and suggestions below are mostly minor. I've also tried to go back and resolve everything that I seemed to be in the critical path of resolving.
For what it's worth, I plan to affirm with a rationale that having the explicit exposition of our goals, how we make tradeoffs between them within the language design, and some indications of success will be necessary for the project to remain cohesive and effective at charting out a viable future path for C++.
docs/project/principles/metrics.md
Outdated
|
||
Our priority OS platforms are: | ||
|
||
- Linux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I would agree with "Common Linux distributions" but I'm not sure that the distinction between that and "Linux", or the fact that "Android" is in some senses a Linux-derived OS, really matters much to most readers. I'd be happy either way there.
Actually, what about something more direct:
"Linux (including common distributions, Android, and ChromeOS)"?
In particular this would be nicer IMO as it gives a single entry for the family, similar to the Apple-based OSes.
proposals/p0051.md
Outdated
likely be expanded by automation. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd not say "Carbon will not support C++ exceptions". I think the interop and migration layer might have a story around exceptions. But I agree w/ the rest of this, maybe just focus there.
Co-authored-by: Chandler Carruth <[email protected]> Co-authored-by: austern <[email protected]>
Co-authored-by: Richard Smith <[email protected]>
|
||
Our goal is to support software where its performance with respect to some set | ||
of resource constraints is critical to its successful operation. This | ||
overarching goal can be decomposed into a few specific aspects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to say anything about "reasonably fast by default" or "favors constructs that can be compiled to efficient code" or something like that? It was the sort of statement I just assumed was in the goals until I reread this section. The way this is written now, we could create a slow language as long as it was predictable and had an inline assembly escape hatch that was painful to use and hence rarely used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO in #106
Note though, I don't think this is an issue right now due to "leave no room for a lower level language" -- inline ASM is still breaking the "rules and structure of Carbon". Arguably it may be unavoidable, but I think the implications should address most of your concern, could maybe just be more explicit.
> new tools has a higher cost than many people | ||
> appreciate."—[John Carmack](https://twitter.com/id_aa_carmack/status/989951283900514304) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> new tools has a higher cost than many people | |
> appreciate."—[John Carmack](https://twitter.com/id_aa_carmack/status/989951283900514304) | |
> new tools has a higher cost than many people appreciate." | |
> —[John Carmack](https://twitter.com/id_aa_carmack/status/989951283900514304) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an emdash, so the current setup is appropriate per style. There's been a suggestion to change project style to deviate from the developer guide, but same as there, I'd rather handle style deviations separate from the proposal, to avoid ratholing on style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, but I don't think that rule applies to naming the author for a block quote. This just looked like a mistake.
**Focus on encouraging appropriate usage of features rather than restricting | ||
misuse.** Adding arbitrary restrictions to prevent misuse of otherwise general | ||
features of the language can create problems when they end up interfering with | ||
unexpected or rare but still appropriate usages. Instead, Carbon should focus on | ||
enabling appropriate and effective usage of features, and creating incentives | ||
around those. What seems initially like a "misuse" of a feature may be critical | ||
for some rare or future use case. Put differently, we will not always be able to | ||
prevent developers from misusing features or writing unnecessarily complex code, | ||
and that is okay. We should instead focus on helping reduce the rate that this | ||
occurs accidentally, and enabling tooling and diagnostics that warn about | ||
dangerous or surprising patterns. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this arguing for uniform & general language rules instead of trying to add exceptions and edge cases? Perhaps some of the argument is that usability includes making the language "simple" in the sense of "less to know to understand"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't view the argument that way. I view it as more based in a concern that Carbon could identify "bad code" structures, and block them, to the loss of complex code that actually needs the structures for performance.
An example might be templates vs generics. We expect generics to be simpler. Rather than blocking use of templates in places we deem inappropriate, we should focus on encouraging use of generics. This is actually the opposite of arguing for simplicity, as the other structures exist and users implicitly need to know when to (or particularly not to) use them.
Simple code is better addressed by the next item, "clearly and simply specified"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I find this paragraph among the weakest in this whole document, and I struggle to make sense of what it is trying to say or how it would be applied.
manageable. This reduces bugs, and will in most cases make the features easier | ||
to understand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"... and the resulting performance more predictable"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding as a TODO; #106
reproducing exact C++ semantics even if bizarre, even this is not guaranteed and | ||
improving on it is not a goal. Migration support will prioritize code that | ||
adheres to reasonable C++ best practices, such as avoiding undefined behavior, | ||
and having reasonable test coverage that passes under sanitizers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wording nit: tests are the thing that pass under sanitizers, not coverage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO work on phrasing; #106
Co-authored-by: josh11b <[email protected]>
Co-authored-by: josh11b <[email protected]>
Proposal accepted, and believe concerns have been addressed.
Co-authored with chandlerc - [Draft doc](https://docs.google.com/document/d/1MJvVIDXQrhIj6hZ7NwMDbDch9XLO2VaYrGq29E57meU/edit) - [RFC topic](https://forums.carbon-lang.dev/t/rfc-goals-for-carbon/69) - [Decision request](https://forums.carbon-lang.dev/t/request-for-decision-goals-for-carbon/91) - [Decision announcement](https://forums.carbon-lang.dev/t/accepted-goals-for-carbon/98)
Co-authored with chandlerc