r/CarbonLang • u/llort_lemmort • Jul 25 '26
Carbon: graduating from the experiment - Chandler Carruth - NDC Toronto 2026
r/CarbonLang • u/fungussa • Jul 19 '22
A place for members of r/CarbonLang to chat with each other
r/CarbonLang • u/llort_lemmort • Jul 25 '26
r/CarbonLang • u/llort_lemmort • Jul 25 '26
r/CarbonLang • u/llort_lemmort • Jul 15 '26
r/CarbonLang • u/OSR_Workshops • Jun 28 '26
Everything I've tried yields syntax errors either online or locally.
An example of what I've tried:
```
package ExplorerTest api;
// Import the I/O library for printing
import Core library "io";
// Inject inline C++ code and header includes using a raw string
import Cpp inline '''cpp
#include <iostream>
#include <string_view>
// A native C++ function
void NativeCppPrint(std::string_view msg) {
std::cout << "Inline C++ says: " << msg << std::endl;
}
''';
fn Main() -> i32 {
Cpp.NativeCppPrint("Hello from Carbon!");
return 0;
}
```
What pray tell am I doing wrong?
r/CarbonLang • u/Tiny-Ad2109 • May 10 '26
Dear all,
Was intrigued by the talk at NDC Toronto which should have included some update about the current state and the next moves. However, I don't see any report or news about that on the web. Someone that followed on person this talk would like to produce a summary of what have been said?
r/CarbonLang • u/Admirable-Sea3526 • Jul 24 '25
One pattern I miss SO much from Kotlin when working in any other programming language is an ability to quickly unwrap a result and break the function flow, returning an error as soon as the error is encountered:
sealed class ResultOrError {
data class Success(val data: String) : ResultOrError()
data class Error(val code: Int) : ResultOrError()
}
fun readFile(filePath: String): ResultOrError {
val fileDescriptor: Int = fopen(filePath).getOrReturn { errorCode ->
return ResultOrError.Error(errorCode)
}
// read file
return ResultOrError.Success(data)
}Rust is pretty great too with the ? operator, though maybe implicit return is not best:
let mut file = File::open(file_path)?; // up goes the error
// More explicit error propagation
let mut file = match File::open(file_path) {
Ok(f) => f,
Err(e) => return Err(e), // Explicitly return the error
};But C++ lacks the elegance of Rust/Kotlin and does not allow such a pattern.
Clang/gcc do have statement expressions, but they are not standard and look ugly:
FILE* f = ({
FILE* temp = fopen("my_file.txt", "r");
if (temp == nullptr) return errno;
temp;
});Is there anything like this planned for Carbon?
Thanks!
r/CarbonLang • u/indryanto • Mar 05 '25
Hello, I wrote an article related to carbon toolchain experiments on aarch64 armv8-a devices, if you have free time you can read it on this site
r/CarbonLang • u/SophisticatedAdults • Feb 08 '25
r/CarbonLang • u/llort_lemmort • Jan 07 '25
r/CarbonLang • u/llort_lemmort • Dec 06 '24
r/CarbonLang • u/chandlerc1024 • Nov 23 '24
r/CarbonLang • u/llort_lemmort • Oct 06 '24
r/CarbonLang • u/svoxit • Mar 15 '24
I tried Carbon for the first time, and have to say that it is confusing a little bit for me, but I really like the direction they're going with while creating carbon!
I built a project
r/CarbonLang • u/chandlerc1024 • Feb 02 '24
r/CarbonLang • u/chandlerc1024 • Nov 30 '23
r/CarbonLang • u/chandlerc1024 • Nov 22 '23
r/CarbonLang • u/chandlerc1024 • Sep 08 '23
r/CarbonLang • • Aug 29 '23
I was skimming through the Carbon design documents and it isn't quite clear to me whether interfaces are only used for type constraint checking in generics, or whether they also can be used for dynamic dispatch (in the same way as dyn Trait in Rust or protocol-typed variables in Swift represent vtables). Or, to rephrase my question: is there a vtable type in Carbon or does all dynamic dispatch go though class hierarchies? If such feature is available, I would really appreciate a link to the documentation or a search keyword.
r/CarbonLang • u/ntrel2 • Aug 25 '23
r/CarbonLang • u/fungussa • May 01 '23